File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ type Config struct {
125125 LogConfig * logConfig `envPrefix:"LOG_"`
126126 LogLevel log.Level `env:"-"`
127127
128- Ready bool
128+ ready bool
129129}
130130
131131func NewConfig () * Config {
@@ -142,7 +142,7 @@ func NewConfig() *Config {
142142}
143143
144144func (cfg * Config ) Parse () error {
145- if cfg .Ready {
145+ if cfg .IsReady () {
146146 return nil
147147 }
148148
@@ -157,15 +157,11 @@ func (cfg *Config) Parse() error {
157157
158158 cfg .LogLevel = log .LogLevelFromStr (cfg .LogConfig .Level )
159159
160- cfg .SetupGlobalVars ()
161-
162- cfg .Ready = true
163-
164160 return nil
165161}
166162
167163func (cfg * Config ) SetupGlobalVars () {
168- if cfg .Ready {
164+ if cfg .IsReady () {
169165 return
170166 }
171167
@@ -218,6 +214,14 @@ func (cfg *Config) SetupGlobalVars() {
218214 setIfNotEmpty (& ConversionWebhookSettings .ListenAddr , cfg .ValidatingWebhookConfig .ListenAddress )
219215}
220216
217+ func (cfg * Config ) IsReady () bool {
218+ return cfg .ready
219+ }
220+
221+ func (cfg * Config ) SetReady () {
222+ cfg .ready = true
223+ }
224+
221225var configInstance * Config
222226
223227func MustGetConfig () * Config {
Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ func Init(logger *log.Logger) (*ShellOperator, error) {
2727 if err != nil {
2828 return nil , fmt .Errorf ("shell-operator config parse: %w" , err )
2929 }
30- appcfg .SetupGlobalVars ()
3130
3231 runtimeConfig := config .NewConfig (logger )
3332 // Init logging subsystem.
You can’t perform that action at this time.
0 commit comments