diff --git a/src/common/gen/Configurator.py b/src/common/gen/Configurator.py index eed443807..a6f89e842 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,21 @@ def __init__( else: self.__variables = variables + # 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()