From 7d0af1ed78c337ba217b5e8e68ee73c350474cc8 Mon Sep 17 00:00:00 2001 From: fsociety Date: Mon, 23 Sep 2024 22:05:20 +0200 Subject: [PATCH] feat: Add support for custom relay files Previously, the only way to specify relays for import and blastr was to list them directly in the .env file. This commit introduces the ability to specify a file path for the relays instead. Two example JSON files have been added to the .gitignore, and instructions for using them have been added to the README. This feature provides a more flexible and scalable way to manage relays. --- .env.example | 4 ++-- .gitignore | 2 ++ README.md | 23 +++++++++++++++++++++++ relays_blastr.json | 30 ------------------------------ relays_import.json | 30 ------------------------------ 5 files changed, 27 insertions(+), 62 deletions(-) delete mode 100644 relays_blastr.json delete mode 100644 relays_import.json diff --git a/.env.example b/.env.example index 317256c..af2dbe5 100644 --- a/.env.example +++ b/.env.example @@ -32,7 +32,7 @@ INBOX_PULL_INTERVAL_SECONDS=600 IMPORT_START_DATE="2023-01-20" IMPORT_QUERY_INTERVAL_SECONDS=600 IMPORT_SEED_RELAYS="relay.damus.io,nos.lol,relay.nostr.band,relay.snort.social,nostr.land,nostr.mom,relay.nos.social,relay.primal.net,relay.nostr.bg,no.str.cr,nostr21.com,nostrue.com,relay.siamstr.com,wot.utxo.one,nostrelites.org,wot.nostr.party,wot.sovbit.host,wot.girino.org,relay.lnau.net,wot.siamstr.com,wot.sudocarlos.com,relay.otherstuff.fyi,relay.lexingtonbitcoin.org,wot.azzamo.net,wot.swarmstr.com,zap.watch,satsage.xyz,wons.calva.dev" -IMPORT_SEED_RELAYS_FILE="" # If you want to use a json file, set this to the path of the file (e.g. "relays_import.json") +IMPORT_SEED_RELAYS_FILE="" ## Backup Settings BACKUP_PROVIDER="aws" @@ -46,7 +46,7 @@ AWS_BUCKET_NAME="utxo-relay-backups" ## Blastr Settings BLASTR_RELAYS="relay.damus.io,nos.lol,relay.nostr.band,relay.snort.social,nostr.land,nostr.mom,relay.nos.social,relay.primal.net,relay.nostr.bg,no.str.cr,nostr21.com,nostrue.com,relay.siamstr.com,wot.utxo.one,nostrelites.org,wot.nostr.party,wot.sovbit.host,wot.girino.org,relay.lnau.net,wot.siamstr.com,wot.sudocarlos.com,relay.otherstuff.fyi,relay.lexingtonbitcoin.org,wot.azzamo.net,wot.swarmstr.com,zap.watch,satsage.xyz,wons.calva.dev" -BLASTR_RELAYS_FILE="" # If you want to use a json file, set this to the path of the file (e.g. "relays_blastr.json") +BLASTR_RELAYS_FILE="" ## OPTIONAL: Docker UID and GID - should be the same as the user running the docker container DOCKER_UID=1000 diff --git a/.gitignore b/.gitignore index 4c49bd7..618c55c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .env +relays_import.example.json +relays_blastr.example.json diff --git a/README.md b/README.md index 5602fe0..521faf1 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,29 @@ cp .env.example .env Open the `.env` file and set the necessary environment variables. +If you want to use custom relay files for import and blastr, you can specify IMPORT_SEED_RELAYS_FILE and BLASTR_RELAYS_FILE in the .env file. First, copy the example JSON files: + +```bash +cp import_seed_relays.example.json import_seed_relays.json +cp blastr_relays.example.json blastr_relays.json +``` + +Then, set the paths to the files in the .env file: + +```bash +IMPORT_SEED_RELAYS_FILE=import_seed_relays.json +BLASTR_RELAYS_FILE=blastr_relays.json +``` + +The JSON should contain an array of relay URLs (without ws:// or wss://): + +```json +[ + "relay.damus.io", + "nos.lol", +] +``` + ### 4. Build the project Run the following command to build the relay: diff --git a/relays_blastr.json b/relays_blastr.json deleted file mode 100644 index 6476d61..0000000 --- a/relays_blastr.json +++ /dev/null @@ -1,30 +0,0 @@ -[ - "relay.damus.io", - "nos.lol", - "relay.nostr.band", - "relay.snort.social", - "nostr.land", - "nostr.mom", - "relay.nos.social", - "relay.primal.net", - "relay.nostr.bg", - "no.str.cr", - "nostr21.com", - "nostrue.com", - "relay.siamstr.com", - "wot.utxo.one", - "nostrelites.org", - "wot.nostr.party", - "wot.sovbit.host", - "wot.girino.org", - "relay.lnau.net", - "wot.siamstr.com", - "wot.sudocarlos.com", - "relay.otherstuff.fyi", - "relay.lexingtonbitcoin.org", - "wot.azzamo.net", - "wot.swarmstr.com", - "zap.watch", - "satsage.xyz", - "wons.calva.dev" -] diff --git a/relays_import.json b/relays_import.json deleted file mode 100644 index 6476d61..0000000 --- a/relays_import.json +++ /dev/null @@ -1,30 +0,0 @@ -[ - "relay.damus.io", - "nos.lol", - "relay.nostr.band", - "relay.snort.social", - "nostr.land", - "nostr.mom", - "relay.nos.social", - "relay.primal.net", - "relay.nostr.bg", - "no.str.cr", - "nostr21.com", - "nostrue.com", - "relay.siamstr.com", - "wot.utxo.one", - "nostrelites.org", - "wot.nostr.party", - "wot.sovbit.host", - "wot.girino.org", - "relay.lnau.net", - "wot.siamstr.com", - "wot.sudocarlos.com", - "relay.otherstuff.fyi", - "relay.lexingtonbitcoin.org", - "wot.azzamo.net", - "wot.swarmstr.com", - "zap.watch", - "satsage.xyz", - "wons.calva.dev" -]