From a0522f344dac3d2aa236ace5c65623226979642f Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Sun, 7 Jul 2024 23:54:03 +0200 Subject: [PATCH] Improved pass resolution --- secret_loader/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/secret_loader/__init__.py b/secret_loader/__init__.py index a9f91db..6ace620 100644 --- a/secret_loader/__init__.py +++ b/secret_loader/__init__.py @@ -20,7 +20,7 @@ Secret loading order: 3. [Pass: the standard unix password manager](https://www.passwordstore.org/). Most suited for personal usage; very unsuited for server environments. Requires `pass` installed - locally, and configuration of the `PASS_FOLDER` through one of the above + locally, and configuration of the `PASS_STORE_SUBFOLDER` through one of the above methods. 4. Vault instance if configured. Suited for production environments. """ @@ -42,7 +42,7 @@ ENV_KEY_VAULT_URL = 'VAULT_URL' ENV_KEY_VAULT_TOKEN = 'VAULT_TOKEN' ENV_KEY_VAULT_MOUNT_POINT = 'VAULT_MOUNT_POINT' -ENV_KEY_PASS_FOLDER = 'PASS_FOLDER' +ENV_KEY_PASS_FOLDER = 'PASS_STORE_SUBFOLDER' class SecretLoader: """ @@ -111,9 +111,9 @@ class SecretLoader: return None cmd = ['pass', 'show', f'{self.pass_folder}/{env_key.lower()}'] - process = subprocess.run(cmd, capture_output = True, check = True) - print(process) - + process = subprocess.run(cmd, capture_output = True) + if process.returncode: + return None return process.stdout.decode('utf8') def _load_or_none_vault(self, env_key: str) -> str | None: