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.
This commit is contained in:
fsociety
2024-09-23 22:05:20 +02:00
parent c19cebe537
commit 7d0af1ed78
5 changed files with 27 additions and 62 deletions

View File

@@ -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

2
.gitignore vendored
View File

@@ -1 +1,3 @@
.env
relays_import.example.json
relays_blastr.example.json

View File

@@ -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:

View File

@@ -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"
]

View File

@@ -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"
]