From 6e647ca1a9f2a3a1ea5df8ed1adc1af0860bce06 Mon Sep 17 00:00:00 2001 From: ppenguin Date: Mon, 6 Apr 2026 13:10:10 +0200 Subject: [PATCH 1/2] add NOMAD_ to exluded prefixes; allow env vars leading _ To support domains starting with a number configured through env vars, we need to prefix them with _ and allow such variables to be handled for config generation. fix env var strip --- src/common/gen/Configurator.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/gen/Configurator.py b/src/common/gen/Configurator.py index eed443807..4da89e343 100644 --- a/src/common/gen/Configurator.py +++ b/src/common/gen/Configurator.py @@ -49,7 +49,7 @@ def __init__( self.__compiled_regexes = {} # Pre-defined exclusion sets for config processing - self.__excluded_prefixes = ("_", "PYTHON", "KUBERNETES_", "SVC_", "LB_", "SUPERVISOR_") + self.__excluded_prefixes = ("PYTHON", "KUBERNETES_", "NOMAD_", "SVC_", "LB_", "SUPERVISOR_") self.__excluded_vars = frozenset( { "DOCKER_HOST", @@ -111,6 +111,12 @@ def __init__( else: self.__variables = variables + """ + NOTE: we now allow _1mthe1_... like (domain) variables to support domain names starting with a number. + This means we immediately trim off starting _ from variable names here. + """ + self.__variables = {k.lstrip("_"): v for k, v in self.__variables.items()} + self.__multisite = self.__variables.get("MULTISITE", "no") == "yes" self.__servers = self.__map_servers() From 6b6b51d375643658ae0889adaed662ff03a6bc76 Mon Sep 17 00:00:00 2001 From: TheophileDiot Date: Tue, 7 Apr 2026 11:25:44 +0200 Subject: [PATCH 2/2] feat: Allow leading underscore in environment variable names for domain compatibility --- src/common/gen/Configurator.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/common/gen/Configurator.py b/src/common/gen/Configurator.py index 4da89e343..a6f89e842 100644 --- a/src/common/gen/Configurator.py +++ b/src/common/gen/Configurator.py @@ -111,11 +111,20 @@ def __init__( else: self.__variables = variables - """ - NOTE: we now allow _1mthe1_... like (domain) variables to support domain names starting with a number. - This means we immediately trim off starting _ from variable names here. - """ - self.__variables = {k.lstrip("_"): v for k, v in self.__variables.items()} + # Allow a leading underscore prefix on env var names so that domain names + # starting with a digit can be configured (bash forbids var names starting + # with a digit, e.g. 1nteresting.io). Users write _1nteresting.io_USE_... + # and we strip the single leading underscore here before any other processing. + stripped: Dict[str, str] = {} + for k, v in self.__variables.items(): + new_key = k.removeprefix("_") + if not new_key: + # Skip bare "_" or similar empty-after-strip keys + continue + if new_key in stripped: + self.__logger.warning(f"Variable collision after stripping leading underscore: both {k!r} and {new_key!r} exist, keeping last value") + stripped[new_key] = v + self.__variables = stripped self.__multisite = self.__variables.get("MULTISITE", "no") == "yes" self.__servers = self.__map_servers()