File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,8 @@ type Config struct {
124124
125125 LogConfig * logConfig `envPrefix:"LOG_"`
126126 LogLevel log.Level `env:"-"`
127+
128+ Ready bool
127129}
128130
129131func NewConfig () * Config {
@@ -140,6 +142,10 @@ func NewConfig() *Config {
140142}
141143
142144func (cfg * Config ) Parse () error {
145+ if cfg .Ready {
146+ return nil
147+ }
148+
143149 opts := env.Options {
144150 Prefix : "" ,
145151 }
@@ -151,10 +157,18 @@ func (cfg *Config) Parse() error {
151157
152158 cfg .LogLevel = log .LogLevelFromStr (cfg .LogConfig .Level )
153159
160+ cfg .SetupGlobalVars ()
161+
162+ cfg .Ready = true
163+
154164 return nil
155165}
156166
157167func (cfg * Config ) SetupGlobalVars () {
168+ if cfg .Ready {
169+ return
170+ }
171+
158172 setIfNotEmpty (& HooksDir , cfg .AppConfig .HooksDir )
159173 setIfNotEmpty (& TempDir , cfg .AppConfig .TmpDir )
160174 setIfNotEmpty (& ListenAddress , cfg .AppConfig .ListenAddress )
You can’t perform that action at this time.
0 commit comments