From ceb4d8d24a5ed8d41feeeca07868fb73a4a68735 Mon Sep 17 00:00:00 2001 From: jaydee Date: Thu, 12 Mar 2026 22:17:24 +0100 Subject: [PATCH] build --- app/scripts/script1.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/app/scripts/script1.py b/app/scripts/script1.py index 77b7f39..c6b59ef 100644 --- a/app/scripts/script1.py +++ b/app/scripts/script1.py @@ -19,19 +19,15 @@ logging.basicConfig( class LoginError(Exception): """Raised when login fails due to invalid credentials or missing CSRF token.""" - +def read_secret(name): + with open(f"/run/secrets/{name}", "r") as f: + return f.read().strip() def setup_vault(): """Sets up and returns a Vault client.""" + value_token = read_secret("vault_token") vault_addr = os.environ.get("VAULT_ADDR", "https://vault.sectorq.eu") - try: - value_token = os.environ.get("VAULT_TOKEN") - if value_token is None: - raise KeyError - except KeyError: - value_token = prompt("Valult root token : ", is_password=True) - print("Use command export VAULT_TOKEN=") - os.environ["VAULT_TOKEN"] = value_token + client = hvac.Client(url=vault_addr, token=value_token) # Check if connected