fix(config): handle missing config file and middleware directory gracefully and log a warning

This commit is contained in:
yusing
2025-09-02 17:20:24 +08:00
parent 4513c221d5
commit 6a3e28dfd7
2 changed files with 12 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
package middleware
import (
"errors"
"io/fs"
"path"
"github.com/rs/zerolog/log"
@@ -63,6 +65,9 @@ func LoadComposeFiles() {
errs := gperr.NewBuilder("middleware compile errors")
middlewareDefs, err := utils.ListFiles(common.MiddlewareComposeBasePath, 0)
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
return
}
log.Err(err).Msg("failed to list middleware definitions")
return
}