Merge pull request #40 from outis1one/clDemoe/seasonal-sunrise-montage-nn268

Fix Python config parser swallowing inline comments as part of values
This commit is contained in:
Outis
2026-04-22 11:05:21 -04:00
committed by GitHub
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -18,7 +18,9 @@ def _read_conf(path):
continue
k, v = line.split('=', 1)
k = k.strip()
v = v.strip().strip('"').strip("'")
v = v.strip()
v = re.sub(r'\s+#.*$', '', v) # strip inline comments
v = v.strip('"').strip("'")
# Extract default from bash ${VAR:-default} pattern
m = re.match(r'^\$\{[^}]+:-([^}]*)\}$', v)
if m:
+3 -1
View File
@@ -20,7 +20,9 @@ def read_config(path):
continue
k, v = line.split('=', 1)
k = k.strip()
v = v.strip().strip('"').strip("'")
v = v.strip()
v = re.sub(r'\s+#.*$', '', v) # strip inline comments
v = v.strip('"').strip("'")
m = re.match(r'^\$\{[^}]+:-([^}]*)\}$', v)
if m:
v = m.group(1).strip('"').strip("'")