feat(conf): make our relays configurable

This commit is contained in:
Fishcake
2023-04-24 15:55:21 +09:00
parent ab982bc51c
commit 32f3673b26
3 changed files with 10 additions and 1 deletions
+2
View File
@@ -10,3 +10,5 @@ FORWARD_URL="/somepageyouwanttoshowdontuseoptionifnone"
NIP05=true
GET_NOSTR_PROFILE=false
LND_PRIVATE_ONLY=false
DB_DIR="./"
OUR_RELAYS="wss://nostr.mutinywallet.com,wss://blastr.f7z.xyz,wss://relay.damus.io/,wss://relay.utxo.one,wss://relay.nostr.ch,wss://eden.nostr.land,wss://nostr.btcmp.com,wss://nostr.relayer.se,wss://relay.current.fyi,wss://nos.lol,wss://nostr.mom,wss://relay.nostr.info,wss://nostr.zebedee.cloud,wss://nostr-pub.wellorder.net,wss://relay.snort.social/,wss://nostr.oxtr.dev/,wss://nostr.fmt.wiz.biz/,wss://brb.io"
+7
View File
@@ -26,6 +26,7 @@ type Settings struct {
Port string `envconfig:"PORT" required:"true"`
Domain string `envconfig:"DOMAIN" required:"true"`
DBDirectory string `envconfig:"DB_DIR" required:"false" default:""`
OURRelayes string `envconfig:"OUR_RELAYS" required:"false" default:""`
// GlobalUsers means that user@ part is globally unique across all domains
// WARNING: if you toggle this existing users won't work anymore for safety reasons!
GlobalUsers bool `envconfig:"GLOBAL_USERS" default:"false"`
@@ -51,6 +52,9 @@ var (
log = zerolog.New(os.Stderr).Output(zerolog.ConsoleWriter{Out: os.Stderr})
)
// array of additional relays
var ourRelays []string
//go:embed index.html
var indexHTML string
@@ -68,6 +72,9 @@ func main() {
log.Fatal().Err(err).Msg("couldn't process envconfig.")
}
// parse our relays
ourRelays = strings.Split(s.OURRelayes, ",")
// increase default makeinvoice client timeout because people are using tor
makeinvoice.Client = &http.Client{Timeout: 25 * time.Second}
+1 -1
View File
@@ -197,7 +197,7 @@ func GetNostrProfileMetaData(npub string) (nostr.ProfileMetadata, error) {
func publishNostrEvent(ev nostr.Event, relays []string) {
// more relays
relays = append(relays, "wss://relay.nostr.ch", "wss://eden.nostr.land", "wss://nostr.btcmp.com", "wss://nostr.relayer.se", "wss://relay.current.fyi", "wss://nos.lol", "wss://nostr.mom", "wss://relay.nostr.info", "wss://nostr.zebedee.cloud", "wss://nostr-pub.wellorder.net", "wss://relay.snort.social/", "wss://relay.damus.io/", "wss://nostr.oxtr.dev/", "wss://nostr.fmt.wiz.biz/", "wss://brb.io")
relays = append(relays, ourRelays...)
// remove trailing /
relays = cleanUrls(relays)
// unique relays