From a2e77cb43356f0ad21e1ae37be0de178ebc0d852 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 21 Dec 2025 22:24:56 -0800 Subject: [PATCH] fix: respect explicitly specified ports and prevent config file override When a port is explicitly specified via CLI flags (e.g., -s3.port=8333), the config file options should NOT override it. Previously, config file options would be applied if the flag value differed from default, but this check wasn't sufficient to prevent override in all cases. Solution: Check the explicitPortFlags map before applying any config file port options. If a port was explicitly passed on the CLI, skip applying the config file option for that port. This ensures: - Explicit ports take absolute precedence over config file ports - Config file ports are only used if port wasn't specified on CLI - Example: 'weed mini -s3.port=8333' will use 8333, never the config file value --- weed/command/mini.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/weed/command/mini.go b/weed/command/mini.go index 952ff0c54..41cdcd078 100644 --- a/weed/command/mini.go +++ b/weed/command/mini.go @@ -608,6 +608,11 @@ func loadMiniConfigurationFile(dataFolder string) (map[string]string, error) { // applyConfigFileOptions sets command-line flags from loaded configuration file func applyConfigFileOptions(options map[string]string) { for key, value := range options { + // Skip port flags that were explicitly passed on CLI + if explicitPortFlags[key] { + glog.V(2).Infof("Skipping config file option %s=%s (explicitly specified on command line)", key, value) + continue + } // Set the flag value if it hasn't been explicitly set on command line flag := cmdMini.Flag.Lookup(key) if flag != nil {