Skip to content

Commit 4887d9c

Browse files
author
Emma Turetsky
committed
Moved webconfig override to after defaults are set
1 parent abf2035 commit 4887d9c

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

config/config.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,17 +1267,6 @@ func SetServerDefaults(v *viper.Viper) error {
12671267
func InitServer(ctx context.Context, currentServers server_structs.ServerType) error {
12681268
InitConfigInternal()
12691269

1270-
webConfigPath := param.Server_WebConfigFile.GetString()
1271-
if webConfigPath != "" {
1272-
if err := os.MkdirAll(filepath.Dir(webConfigPath), 0700); err != nil {
1273-
cobra.CheckErr(errors.Wrapf(err, "failed to create directory for web config file at %s", webConfigPath))
1274-
}
1275-
}
1276-
if err := setWebConfigOverride(viper.GetViper(), webConfigPath); err != nil {
1277-
cobra.CheckErr(errors.Wrapf(err, "failed to override configuration based on changes from web UI"))
1278-
}
1279-
1280-
logging.FlushLogs(true)
12811270
setEnabledServer(currentServers)
12821271

12831272
// Output warnings before the defaults are set. The SetServerDefaults function sets the default values
@@ -1299,6 +1288,16 @@ func InitServer(ctx context.Context, currentServers server_structs.ServerType) e
12991288
return err
13001289
}
13011290

1291+
webConfigPath := param.Server_WebConfigFile.GetString()
1292+
if webConfigPath != "" {
1293+
if err := os.MkdirAll(filepath.Dir(webConfigPath), 0700); err != nil {
1294+
cobra.CheckErr(errors.Wrapf(err, "failed to create directory for web config file at %s", webConfigPath))
1295+
}
1296+
}
1297+
if err := setWebConfigOverride(viper.GetViper(), webConfigPath); err != nil {
1298+
cobra.CheckErr(errors.Wrapf(err, "failed to override configuration based on changes from web UI"))
1299+
}
1300+
13021301
// Flush logs only after we potentially ingest changes from the web UI. This must
13031302
// be done in sequence because the web UI may change the log location.
13041303
logging.FlushLogs(true)

0 commit comments

Comments
 (0)