xenoslib 0.1.29.22__tar.gz → 0.1.29.24__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.22/xenoslib.egg-info → xenoslib-0.1.29.24}/PKG-INFO +1 -1
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib/about.py +1 -1
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib/extend.py +20 -3
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24/xenoslib.egg-info}/PKG-INFO +1 -1
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/LICENSE +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/README.md +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/setup.cfg +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/setup.py +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib/__init__.py +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib/__main__.py +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib/base.py +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib/dev.py +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib/linux.py +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib/mail.py +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib/mock.py +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib/onedrive.py +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib/win_trayicon.py +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib/windows.py +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib.egg-info/SOURCES.txt +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib.egg-info/dependency_links.txt +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib.egg-info/requires.txt +0 -0
- {xenoslib-0.1.29.22 → xenoslib-0.1.29.24}/xenoslib.egg-info/top_level.txt +0 -0
|
@@ -253,7 +253,9 @@ class ConfigLoader(SingletonWithArgs):
|
|
|
253
253
|
raise KeyError("Missing required Vault configuration in config.yml")
|
|
254
254
|
|
|
255
255
|
self.vault_client = hvac.Client(url=vault_url, namespace=vault_space, timeout=45)
|
|
256
|
-
self.vault_client.auth.approle.login(
|
|
256
|
+
self.vault_client.auth.approle.login(
|
|
257
|
+
role_id=vault_role_id, secret_id=self.vault_secret_id
|
|
258
|
+
)
|
|
257
259
|
except Exception as e:
|
|
258
260
|
self.vault_client = None
|
|
259
261
|
raise Exception(f"Failed to initialize Vault client: {str(e)}")
|
|
@@ -323,6 +325,11 @@ class ConfigLoader(SingletonWithArgs):
|
|
|
323
325
|
try:
|
|
324
326
|
vault_path = self._raw_config[section]["vault_path"]
|
|
325
327
|
vault_key = self._raw_config[section][f"{key_name}@vault"]
|
|
328
|
+
vault_namepsace = self._raw_config[section].get("vault_namespace")
|
|
329
|
+
if vault_namepsace:
|
|
330
|
+
self.vault_client.adapter.namespace = vault_namepsace
|
|
331
|
+
else:
|
|
332
|
+
self.vault_client.adapter.namespace = self._raw_config["vault"]["space"]
|
|
326
333
|
data = self.vault_client.secrets.kv.read_secret_version(
|
|
327
334
|
path=vault_path, mount_point="kv", raise_on_deleted_version=True
|
|
328
335
|
)
|
|
@@ -355,6 +362,13 @@ class SectionProxy:
|
|
|
355
362
|
"""Dictionary-style access to configuration values."""
|
|
356
363
|
return self._loader.get(self._section, key)
|
|
357
364
|
|
|
365
|
+
def get(self, key, default=None):
|
|
366
|
+
"""Dictionary-style access to configuration values."""
|
|
367
|
+
try:
|
|
368
|
+
return self._loader.get(self._section, key)
|
|
369
|
+
except KeyError:
|
|
370
|
+
return default
|
|
371
|
+
|
|
358
372
|
def __getattr__(self, key):
|
|
359
373
|
"""Attribute-style access to configuration values."""
|
|
360
374
|
try:
|
|
@@ -373,5 +387,8 @@ if __name__ == "__main__":
|
|
|
373
387
|
|
|
374
388
|
# This will only work if you provide a valid Vault secret ID
|
|
375
389
|
# and hvac package is installed
|
|
376
|
-
config_with_vault = ConfigLoader("config.yml", vault_secret_id=os.getenv("
|
|
377
|
-
|
|
390
|
+
config_with_vault = ConfigLoader("config.yml", vault_secret_id=os.getenv("VAULT_SECRET_ID"))
|
|
391
|
+
|
|
392
|
+
print("With Vault:", config_with_vault.test.test)
|
|
393
|
+
print("With Vault:", config_with_vault["cis"]["cis_client_id"])
|
|
394
|
+
print("Try val not exists: ", config_with_vault.test.get("not_exists"))
|
|
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
|