Skip to content

Commit a229781

Browse files
authored
Fix: Empty CLI string defaults no longer override env/API config (#17)
When CLI arguments with empty string defaults (like --dockerfiles) are not explicitly provided by the user, they were incorrectly overwriting non-empty values loaded from environment variables or the Socket Basics API config. The issue was that the check `if arg_value is not None` passed for empty strings, causing `config_dict['dockerfiles'] = ""` to wipe out the value from the dashboard config. Changed the condition to `if arg_value` (truthy check) for non-bool types, so empty string defaults don't override actual config values. This fixes Dockerfile scanning not working when configured via the Socket dashboard, as the `dockerfiles` value was being cleared by the CLI default.
1 parent bf6c73c commit a229781

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

socket_basics/core/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,9 @@ def create_config_from_args(args) -> Config:
12751275
for disabled_param in param['disables']:
12761276
config_dict[disabled_param] = False
12771277

1278-
elif param.get('type') != 'bool':
1278+
elif param.get('type') != 'bool' and arg_value:
1279+
# Only override config for non-bool types if CLI arg has a value
1280+
# This prevents empty string defaults from wiping out env/API config
12791281
config_dict[param_name] = arg_value
12801282
except Exception as e:
12811283
logging.getLogger(__name__).warning("Warning: Error processing dynamic CLI args: %s", e)

0 commit comments

Comments
 (0)