Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(config): not exiting process after update and reloading config #74

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}