xenoslib 0.1.29.16__tar.gz → 0.1.29.18__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.
- {xenoslib-0.1.29.16/xenoslib.egg-info → xenoslib-0.1.29.18}/PKG-INFO +1 -1
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib/about.py +1 -1
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib/extend.py +6 -4
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18/xenoslib.egg-info}/PKG-INFO +1 -1
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/LICENSE +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/README.md +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/setup.cfg +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/setup.py +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib/__init__.py +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib/__main__.py +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib/base.py +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib/dev.py +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib/linux.py +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib/mail.py +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib/mock.py +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib/onedrive.py +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib/win_trayicon.py +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib/windows.py +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib.egg-info/SOURCES.txt +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib.egg-info/dependency_links.txt +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib.egg-info/requires.txt +0 -0
- {xenoslib-0.1.29.16 → xenoslib-0.1.29.18}/xenoslib.egg-info/top_level.txt +0 -0
|
@@ -7,6 +7,8 @@ import logging
|
|
|
7
7
|
import yaml
|
|
8
8
|
import requests
|
|
9
9
|
|
|
10
|
+
from xenoslib.base import SingletonWithArgs
|
|
11
|
+
|
|
10
12
|
|
|
11
13
|
logger = logging.getLogger(__name__)
|
|
12
14
|
|
|
@@ -192,7 +194,7 @@ class DingTalkLogHandler(logging.Handler):
|
|
|
192
194
|
print(exc)
|
|
193
195
|
|
|
194
196
|
|
|
195
|
-
class ConfigLoader:
|
|
197
|
+
class ConfigLoader(SingletonWithArgs):
|
|
196
198
|
"""Centralized configuration management with optional Vault integration.
|
|
197
199
|
|
|
198
200
|
Args:
|
|
@@ -211,12 +213,12 @@ class ConfigLoader:
|
|
|
211
213
|
>>> config = ConfigLoader("config.yml", vault_secret_id="my-secret-id")
|
|
212
214
|
"""
|
|
213
215
|
|
|
216
|
+
cache = {}
|
|
217
|
+
|
|
214
218
|
def __init__(self, config_file_path="config.yml", vault_secret_id=None):
|
|
215
219
|
"""Initialize the ConfigLoader with a configuration file and optional Vault secret."""
|
|
216
220
|
with open(config_file_path, "r") as f:
|
|
217
221
|
self._raw_config = yaml.safe_load(f) or {}
|
|
218
|
-
|
|
219
|
-
self.cache = {}
|
|
220
222
|
self.vault_client = None
|
|
221
223
|
|
|
222
224
|
if vault_secret_id is not None:
|
|
@@ -289,9 +291,9 @@ class ConfigLoader:
|
|
|
289
291
|
)
|
|
290
292
|
|
|
291
293
|
cache_key = f"{section}_{key_name}"
|
|
294
|
+
|
|
292
295
|
if use_cache and cache_key in self.cache:
|
|
293
296
|
return self.cache[cache_key]
|
|
294
|
-
|
|
295
297
|
value = self._get_value_from_vault(section, key_name)
|
|
296
298
|
self.cache[cache_key] = value
|
|
297
299
|
return value
|
|
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
|