From c96a3b75386dfe02945ae75160875bb00afacfcd Mon Sep 17 00:00:00 2001 From: Marius Scurtescu Date: Sun, 18 Feb 2024 22:29:52 -0800 Subject: [PATCH] add env var based default addresses for RPC endpoints (#49) * add env var based default addresses for RPC endpoints * set default addresses for gRPC and REST --- docker-compose.yml | 3 +++ node/config/config.go | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 3f19c89..ad8887e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,9 @@ services: build: ./ image: quilibrium restart: always + environment: + - DEFAULT_LISTEN_GRPC_MULTIADDR=/ip4/0.0.0.0/tcp/8337 + - DEFAULT_LISTEN_REST_MULTIADDR=/ip4/0.0.0.0/tcp/8338 ports: - '8336:8336/udp' # p2p - '127.0.0.1:8337:8337/tcp' # gRPC diff --git a/node/config/config.go b/node/config/config.go index e4cfe73..d9387f8 100644 --- a/node/config/config.go +++ b/node/config/config.go @@ -137,6 +137,11 @@ func LoadConfig(configPath string, proverKey string) (*Config, error) { config.Key.KeyStoreFile.EncryptionKey = hex.EncodeToString(keystoreKey) + if multiAddr := os.Getenv("DEFAULT_LISTEN_GRPC_MULTIADDR"); multiAddr != "" { + config.ListenGRPCMultiaddr = multiAddr + config.ListenRestMultiaddr = os.Getenv("DEFAULT_LISTEN_REST_MULTIADDR") + } + fmt.Println("Saving config...") if err = SaveConfig(configPath, config); err != nil { panic(err)