aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2025-10-31 12:49:04 -0700
committerchrislu <chris.lu@gmail.com>2025-10-31 12:49:04 -0700
commit58acc14d2cfb1406901c2ed983e5b752df43d97a (patch)
treea56eb08e973af99f527e3195adaf0eb5b442eed5
parentf00ae727b7f7cc85b5312e779f81af9e3eb931f0 (diff)
downloadseaweedfs-58acc14d2cfb1406901c2ed983e5b752df43d97a.tar.xz
seaweedfs-58acc14d2cfb1406901c2ed983e5b752df43d97a.zip
avoid unnecessary fail fast
fix https://github.com/seaweedfs/seaweedfs/issues/7417
-rw-r--r--weed/util/config.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/weed/util/config.go b/weed/util/config.go
index e5b32d512..181b5efa9 100644
--- a/weed/util/config.go
+++ b/weed/util/config.go
@@ -52,16 +52,20 @@ func LoadConfiguration(configFileName string, required bool) (loaded bool) {
if strings.Contains(err.Error(), "Not Found") {
glog.V(1).Infof("Reading %s: %v", viper.ConfigFileUsed(), err)
} else {
- glog.Fatalf("Reading %s: %v", viper.ConfigFileUsed(), err)
+ // If the config is required, fail immediately
+ if required {
+ glog.Fatalf("Reading %s: %v", viper.ConfigFileUsed(), err)
+ }
+ // If the config is optional, log a warning but don't crash
+ glog.Warningf("Reading %s: %v. Skipping optional configuration.", viper.ConfigFileUsed(), err)
}
if required {
glog.Fatalf("Failed to load %s.toml file from current directory, or $HOME/.seaweedfs/, or /etc/seaweedfs/"+
"\n\nPlease use this command to generate the default %s.toml file\n"+
" weed scaffold -config=%s -output=.\n\n\n",
configFileName, configFileName, configFileName)
- } else {
- return false
}
+ return false
}
glog.V(1).Infof("Reading %s.toml from %s", configFileName, viper.ConfigFileUsed())