Coderabbit fixes:

- Mac
- Flask debug
- Threaded flask
- propagate token in GET requests
- enhance spec docs
- normalize MAC x2
- mcp disablement redundant private attribute
- run all tests imports
This commit is contained in:
Adam Outler
2026-01-19 00:03:27 +00:00
parent ecea1d1fbd
commit bb0c0e1c74
13 changed files with 326 additions and 55 deletions

View File

@@ -361,6 +361,42 @@ def setting_value_to_python_type(set_type, set_value):
return value
# -------------------------------------------------------------------------------
# Environment helper
def get_env_setting_value(key, default=None):
"""Return a typed value from environment variable if present.
- Parses booleans (1/0, true/false, yes/no, on/off).
- Tries to parse ints and JSON literals where sensible.
- Returns `default` when env var is not set.
"""
val = os.environ.get(key)
if val is None:
return default
v = val.strip()
# Booleans
low = v.lower()
if low in ("1", "true", "yes", "on"):
return True
if low in ("0", "false", "no", "off"):
return False
# Integer
try:
if re.fullmatch(r"-?\d+", v):
return int(v)
except Exception:
pass
# JSON-like (list/object/true/false/null/number)
try:
return json.loads(v)
except Exception:
# Fallback to raw string
return v
# -------------------------------------------------------------------------------
def updateSubnets(scan_subnets):
"""