diff --git a/comms/discovery/config/config.go b/comms/discovery/config/config.go index 6f629593a5b..e8c9037e06a 100644 --- a/comms/discovery/config/config.go +++ b/comms/discovery/config/config.go @@ -18,6 +18,7 @@ type DiscoveryConfig struct { MyWallet string MyPrivateKey *ecdsa.PrivateKey `json:"-"` IsStaging bool + IsSandbox bool // audius-d sandbox (comms_sandbox env var) IsDev bool IsRegisteredWallet bool @@ -44,6 +45,7 @@ func Parse() *DiscoveryConfig { c.MyHost = misc.TrimTrailingSlash(os.Getenv("audius_discprov_url")) c.IsStaging = os.Getenv("AUDIUS_IS_STAGING") == "true" c.IsDev = os.Getenv("comms_dev_mode") == "true" + c.IsSandbox = os.Getenv("comms_sandbox") == "true" pk, err := parsePrivateKey(os.Getenv("audius_delegate_private_key")) if err != nil { diff --git a/comms/discovery/discovery_main.go b/comms/discovery/discovery_main.go index 449abd3e8cb..974312b7126 100644 --- a/comms/discovery/discovery_main.go +++ b/comms/discovery/discovery_main.go @@ -88,7 +88,7 @@ func backgroundRefreshRegisteredPeers(discoveryConfig *config.DiscoveryConfig) { } func refreshRegisteredPeers(discoveryConfig *config.DiscoveryConfig) error { - if discoveryConfig.IsDev { + if discoveryConfig.IsDev || discoveryConfig.IsSandbox { discoveryConfig.IsRegisteredWallet = true return nil } diff --git a/comms/discovery/pubkeystore/recover.go b/comms/discovery/pubkeystore/recover.go index 05b5656082f..553dabc909c 100644 --- a/comms/discovery/pubkeystore/recover.go +++ b/comms/discovery/pubkeystore/recover.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "math/big" + "os" "strings" "comms.audius.co/discovery/config" @@ -53,6 +54,13 @@ func Dial(discoveryConfig *config.DiscoveryConfig) error { finalPoaBlock = -1 } + if discoveryConfig.IsSandbox { + acdcEndpoint = os.Getenv("audius_web3_eth_provider_url") + poaEndpoint = os.Getenv("audius_web3_host") + verifyingContract = os.Getenv("audius_contracts_entity_manager_address") + finalPoaBlock = -1 + } + poaClient, err = ethclient.Dial(poaEndpoint) if err != nil { return err diff --git a/comms/discovery/server/server.go b/comms/discovery/server/server.go index 28bffbf3c34..6ce5653e49a 100644 --- a/comms/discovery/server/server.go +++ b/comms/discovery/server/server.go @@ -118,7 +118,7 @@ func (s *ChatServer) getStatus(c echo.Context) error { } func (s *ChatServer) isHealthy() bool { - if s.config.IsDev { + if s.config.IsDev || s.config.IsSandbox { return true } return s.config.IsRegisteredWallet && s.websocketError == nil