Skip to content

Commit 86b26be

Browse files
committed
change logic
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
1 parent 4335082 commit 86b26be

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

pkg/app/app_config.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff 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

131131
func NewConfig() *Config {
@@ -142,7 +142,7 @@ func NewConfig() *Config {
142142
}
143143

144144
func (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

167163
func (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+
221225
var configInstance *Config
222226

223227
func MustGetConfig() *Config {

pkg/shell-operator/bootstrap.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff 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.

0 commit comments

Comments
 (0)