Add cmd line option to pinecone demo for enabling relaying

This commit is contained in:
Devon Hudson 2023-01-29 18:13:39 -07:00
parent 0f998e3af3
commit f98003c030
No known key found for this signature in database
GPG key ID: CD06B18E77F6A628

View file

@ -64,11 +64,12 @@ import (
) )
var ( var (
instanceName = flag.String("name", "dendrite-p2p-pinecone", "the name of this P2P demo instance") instanceName = flag.String("name", "dendrite-p2p-pinecone", "the name of this P2P demo instance")
instancePort = flag.Int("port", 8008, "the port that the client API will listen on") instancePort = flag.Int("port", 8008, "the port that the client API will listen on")
instancePeer = flag.String("peer", "", "the static Pinecone peers to connect to, comma separated-list") instancePeer = flag.String("peer", "", "the static Pinecone peers to connect to, comma separated-list")
instanceListen = flag.String("listen", ":0", "the port Pinecone peers can connect to") instanceListen = flag.String("listen", ":0", "the port Pinecone peers can connect to")
instanceDir = flag.String("dir", ".", "the directory to store the databases in (if --config not specified)") instanceDir = flag.String("dir", ".", "the directory to store the databases in (if --config not specified)")
instanceRelayingEnabled = flag.Bool("relay", false, "whether to enable store & forward relaying for other nodes")
) )
const relayServerRetryInterval = time.Second * 30 const relayServerRetryInterval = time.Second * 30
@ -244,7 +245,8 @@ func main() {
Config: &base.Cfg.FederationAPI, Config: &base.Cfg.FederationAPI,
UserAPI: userAPI, UserAPI: userAPI,
} }
relayAPI := relayapi.NewRelayInternalAPI(base, federation, rsAPI, keyRing, producer, true) relayAPI := relayapi.NewRelayInternalAPI(base, federation, rsAPI, keyRing, producer, *instanceRelayingEnabled)
logrus.Infof("Relaying enabled: %v", relayAPI.RelayingEnabled())
monolith := setup.Monolith{ monolith := setup.Monolith{
Config: base.Cfg, Config: base.Cfg,