base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / py / pyload-ng / declarative-env-config.patch
blob42f89ee485cb28c77db4be5ed7f756ff643df5cd
1 diff --git a/src/pyload/core/__init__.py b/src/pyload/core/__init__.py
2 index 4324fc700..5d915a85e 100644
3 --- a/src/pyload/core/__init__.py
4 +++ b/src/pyload/core/__init__.py
5 @@ -128,6 +128,13 @@ class Core:
6 else:
7 self._debug = max(0, int(debug))
9 + # Allow setting any option declaratively, for the NixOS module
10 + for env, value in os.environ.items():
11 + if not env.startswith("PYLOAD__"):
12 + continue
13 + section, opt = env.removeprefix("PYLOAD__").lower().split("__")
14 + self.config.set(section, opt, value)
16 # If no argument set, read storage dir from config file,
17 # otherwise save setting to config dir
18 if storagedir is None: