zpp_config 2.2.3__tar.gz → 2.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {zpp_config-2.2.3/zpp_config.egg-info → zpp_config-2.2.4}/PKG-INFO +1 -1
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/config.py +22 -5
- {zpp_config-2.2.3 → zpp_config-2.2.4/zpp_config.egg-info}/PKG-INFO +1 -1
- {zpp_config-2.2.3 → zpp_config-2.2.4}/LICENSE +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/README.md +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/setup.cfg +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/tests/test_access.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/tests/test_backends.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/tests/test_merge_update_delete.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/tests/test_validation.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/__init__.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/backend/__init__.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/backend/cfg.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/backend/global_backend.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/backend/ini.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/backend/json.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/backend/toml.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/backend/yaml.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/cli.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/core/__init__.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/core/autoreload.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/core/logs.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/core/vault.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/core/vault_encryption.py +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config.egg-info/SOURCES.txt +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config.egg-info/dependency_links.txt +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config.egg-info/entry_points.txt +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config.egg-info/requires.txt +0 -0
- {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config.egg-info/top_level.txt +0 -0
|
@@ -384,7 +384,7 @@ class Config(ConfigNode):
|
|
|
384
384
|
{'module':'jinja2', 'submodule': ['Environment']},
|
|
385
385
|
{'module':'zpp_config.core.vault_encryption', 'submodule': ['vault_decrypt']},
|
|
386
386
|
)
|
|
387
|
-
def __init__(self, filename, filetype=None, context=None, vault_file=None, vault_keyfile=None, vault_password=None, vault_encryption_keyfile=None, vault_encryption_password=None):
|
|
387
|
+
def __init__(self, filename, filetype=None, context=None, vault_file=None, vault_keyfile=None, vault_password=None, vault_encryption_keyfile=None, vault_encryption_password=None, disable_jinja_render=False):
|
|
388
388
|
self._filename = Path(filename)
|
|
389
389
|
self._context = context or {}
|
|
390
390
|
|
|
@@ -404,6 +404,7 @@ class Config(ConfigNode):
|
|
|
404
404
|
loader=SafeFileSystemLoader(self._filename.parent),
|
|
405
405
|
autoescape=False
|
|
406
406
|
)
|
|
407
|
+
self._disable_jinja_render = disable_jinja_render
|
|
407
408
|
|
|
408
409
|
# Fonction pour récupérer une clé dans un vault
|
|
409
410
|
def vault(key):
|
|
@@ -461,18 +462,34 @@ class Config(ConfigNode):
|
|
|
461
462
|
self._loaded = False
|
|
462
463
|
super().__init__(path="", _data={})
|
|
463
464
|
|
|
465
|
+
def _read_source(self):
|
|
466
|
+
"""
|
|
467
|
+
Read file content using the Jinja loader logic
|
|
468
|
+
(handles UTF-8 + Windows cp1252 fallback).
|
|
469
|
+
"""
|
|
470
|
+
# On passe volontairement par le loader Jinja
|
|
471
|
+
source, _, _ = self._env.loader.get_source(
|
|
472
|
+
self._env, self._filename.name
|
|
473
|
+
)
|
|
474
|
+
return source
|
|
475
|
+
|
|
464
476
|
def load(self):
|
|
465
477
|
"""Render Jinja + parse via backend"""
|
|
466
478
|
if not self._filename.exists():
|
|
467
479
|
self._data = {}
|
|
468
480
|
self._loaded = True
|
|
481
|
+
return
|
|
482
|
+
|
|
483
|
+
raw = self._read_source()
|
|
469
484
|
|
|
485
|
+
if self._disable_jinja_render:
|
|
486
|
+
data = raw
|
|
470
487
|
else:
|
|
471
|
-
template = self._env.
|
|
472
|
-
|
|
488
|
+
template = self._env.from_string(raw)
|
|
489
|
+
data = template.render(**self._context)
|
|
473
490
|
|
|
474
|
-
|
|
475
|
-
|
|
491
|
+
self._data = self._backend.load_data(data)
|
|
492
|
+
self._loaded = True
|
|
476
493
|
|
|
477
494
|
def reload(self):
|
|
478
495
|
"""Re-render si le context a changé"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|