mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 17:28:31 +02:00
fix(config): handle critical config errors
Propagate critical init and entrypoint failures to halt startup and log them as fatal during config loading
This commit is contained in:
@@ -60,6 +60,16 @@ func Load() error {
|
||||
|
||||
cfgWatcher = watcher.NewConfigFileWatcher(common.ConfigFileName)
|
||||
|
||||
initErr := state.InitFromFile(common.ConfigPath)
|
||||
if initErr != nil {
|
||||
// if error is critical, notify and return it without starting providers
|
||||
var criticalErr CriticalError
|
||||
if errors.As(initErr, &criticalErr) {
|
||||
logNotifyError("init", criticalErr.err)
|
||||
return criticalErr.err
|
||||
}
|
||||
}
|
||||
|
||||
// disable pool logging temporary since we already have pretty logging
|
||||
routes.HTTP.DisableLog(true)
|
||||
routes.Stream.DisableLog(true)
|
||||
|
||||
Reference in New Issue
Block a user