Skip to content

Commit

Permalink
Add Circle Config Settings Validation
Browse files Browse the repository at this point in the history
  • Loading branch information
joelsmith-2019 committed Apr 11, 2024
1 parent d504aab commit 6c2ec95
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmd/appstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,18 @@ func (a *AppState) loadConfigFile() {
}
a.Logger.Info("Successfully parsed config file", "location", a.ConfigPath)
a.Config = config
a.validateConfig()
}

// validateConfig checks the AppState Config for any invalid settings.
func (a *AppState) validateConfig() {
if a.Config.Circle.AttestationBaseUrl == "" {
a.Logger.Error("AttestationBaseUrl is required in the config")
os.Exit(1)
}

if a.Config.Circle.FetchRetryInterval == 0 {
a.Logger.Error("FetchRetryInterval must be greater than zero in the config")
os.Exit(1)
}
}

0 comments on commit 6c2ec95

Please sign in to comment.