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
This commit is contained in:
Marius Scurtescu 2024-02-18 22:29:52 -08:00 committed by GitHub
parent 2b232a8e2f
commit c96a3b7538
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,9 @@ services:
build: ./ build: ./
image: quilibrium image: quilibrium
restart: always 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: ports:
- '8336:8336/udp' # p2p - '8336:8336/udp' # p2p
- '127.0.0.1:8337:8337/tcp' # gRPC - '127.0.0.1:8337:8337/tcp' # gRPC

View File

@ -137,6 +137,11 @@ func LoadConfig(configPath string, proverKey string) (*Config, error) {
config.Key.KeyStoreFile.EncryptionKey = hex.EncodeToString(keystoreKey) 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...") fmt.Println("Saving config...")
if err = SaveConfig(configPath, config); err != nil { if err = SaveConfig(configPath, config); err != nil {
panic(err) panic(err)