Skip to content

Commit 92542ad

Browse files
committed
allow config override from env
1 parent d5e299e commit 92542ad

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

client/config/read.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
"github.com/BurntSushi/toml"
1212
"github.com/ethereum/go-ethereum/accounts/abi"
13+
"github.com/kelseyhightower/envconfig"
1314
)
1415

1516
// ReadConfigs reads user and system configurations from userFilePath and systemDirectoryPath.
@@ -26,6 +27,11 @@ func ReadConfigs(userFilePath, systemDirectoryPath string) (*UserRaw, *System, e
2627
return nil, nil, err
2728
}
2829

30+
err = envconfig.Process("", &userConfigRaw)
31+
if err != nil {
32+
return nil, nil, fmt.Errorf("reading env variables: %w", err)
33+
}
34+
2935
return &userConfigRaw, &systemConfig, nil
3036
}
3137

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ require (
88
github.com/ethereum/go-ethereum v1.14.12
99
github.com/flare-foundation/go-flare-common v1.2.0
1010
github.com/gorilla/mux v1.8.1
11+
github.com/kelseyhightower/envconfig v1.4.0
1112
github.com/pkg/errors v0.9.1
1213
github.com/rs/cors v1.11.1
1314
github.com/stretchr/testify v1.10.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
162162
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
163163
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
164164
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
165+
github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=
166+
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
165167
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
166168
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
167169
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=

0 commit comments

Comments
 (0)