mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-29 21:31:48 +02:00
fix(config): handle missing config file and middleware directory gracefully and log a warning
This commit is contained in:
@@ -220,7 +220,13 @@ func (cfg *Config) load() gperr.Error {
|
||||
|
||||
data, err := os.ReadFile(common.ConfigPath)
|
||||
if err != nil {
|
||||
gperr.LogFatal(errMsg, err)
|
||||
if os.IsNotExist(err) {
|
||||
log.Warn().Msg("config file not found, using default config")
|
||||
cfg.value = config.DefaultConfig()
|
||||
return nil
|
||||
} else {
|
||||
gperr.LogFatal(errMsg, err)
|
||||
}
|
||||
}
|
||||
|
||||
model := config.DefaultConfig()
|
||||
|
||||
Reference in New Issue
Block a user