Skip to content

Commit

Permalink
feat(config): not exiting process after update and reloading config (#74
Browse files Browse the repository at this point in the history
)
  • Loading branch information
utsavmaniyar authored Jul 10, 2023
1 parent 695fc17 commit a96d2a2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,14 @@ func (eb *EarlybirdCfg) ConfigInit() {
if *ptrStreamInput || eb.Config.GitStream {
eb.Config.SearchDir = ""
}
// Check to see if the user opted to update. If they choose this option
// the configuration files will be updated and the program will exit.
// Check to see if the user opted to update config. If they choose this option
// the configuration files will be updated and load config again.
if *ptrUpdateFlag {
doUpdate(eb.Config.ConfigDir, eb.Config.RulesConfigDir, earlybirdConfigPath, cfgreader.Settings.ConfigFileURL, eb.Config.RuleModulesFilenameMap)
err = cfgreader.LoadConfig(&cfgreader.Settings, earlybirdConfigPath)
if err != nil {
log.Fatal("failed to load Earlybird config", err)
}
}

// Set the skip options (what not to scan) from configs
Expand Down Expand Up @@ -374,5 +378,4 @@ func doUpdate(configDir, rulesConfigDir, configPath, appConfigURL string, ruleMo
log.Fatal("Failed to update config:", err)
}
log.Println("Configurations updated. Exiting")
os.Exit(0)
}

0 comments on commit a96d2a2

Please sign in to comment.