diff --git a/sunrise.py b/sunrise.py index 9db1156..1db47d1 100755 --- a/sunrise.py +++ b/sunrise.py @@ -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: diff --git a/sunrise2mm.py b/sunrise2mm.py index e999d56..f51355e 100755 --- a/sunrise2mm.py +++ b/sunrise2mm.py @@ -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("'")