Skip to content

Commit

Permalink
tapcfg: add flag to disable default federation server
Browse files Browse the repository at this point in the history
This commit adds a new universe.no-default-federation boolean flag that
allows the user to disable adding the default federation server.
  • Loading branch information
guggero committed Nov 14, 2024
1 parent f0907b5 commit eb54840
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
2 changes: 2 additions & 0 deletions tapcfg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ type UniverseConfig struct {

FederationServers []string `long:"federationserver" description:"The host:port of a Universe server peer with. These servers will be added as the default set of federation servers. Can be specified multiple times."`

NoDefaultFederation bool `long:"no-default-federation" description:"If set, the default Universe server (available for testnet and mainnet) will not be added to the list of universe servers on startup."`

SyncAllAssets bool `long:"sync-all-assets" description:"If set, the federation syncer will default to syncing all assets."`

PublicAccess string `long:"public-access" description:"The public access mode for the universe server, controlling whether remote parties can read from and/or write to this universe server over RPC if exposed to a public network interface. This can be unset, 'r', 'w', or 'rw'. If unset, public access is not enabled for the universe server. If 'r' is included, public access is allowed for read-only endpoints. If 'w' is included, public access is allowed for write endpoints."`
Expand Down
38 changes: 26 additions & 12 deletions tapcfg/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,19 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger,
federationMembers := cfg.Universe.FederationServers
switch cfg.ChainConf.Network {
case "mainnet":
cfgLogger.Infof("Configuring %v as initial Universe "+
"federation server", defaultMainnetFederationServer)

federationMembers = append(
federationMembers, defaultMainnetFederationServer,
)
// Add our default mainnet federation server to the list of
// federation servers if not disabled by the user for privacy
// reasons.
if !cfg.Universe.NoDefaultFederation {
cfgLogger.Infof("Configuring %v as initial Universe "+
"federation server",
defaultMainnetFederationServer)

federationMembers = append(
federationMembers,
defaultMainnetFederationServer,
)
}

// For mainnet, we need to overwrite the default universe proof
// courier address to use the mainnet server.
Expand All @@ -204,12 +211,19 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger,
}

case "testnet":
cfgLogger.Infof("Configuring %v as initial Universe "+
"federation server", defaultTestnetFederationServer)

federationMembers = append(
federationMembers, defaultTestnetFederationServer,
)
// Add our default testnet federation server to the list of
// federation servers if not disabled by the user for privacy
// reasons.
if !cfg.Universe.NoDefaultFederation {
cfgLogger.Infof("Configuring %v as initial Universe "+
"federation server",
defaultTestnetFederationServer)

federationMembers = append(
federationMembers,
defaultTestnetFederationServer,
)
}

default:
// For any other network, such as regtest, we can't use a
Expand Down

0 comments on commit eb54840

Please sign in to comment.