This commit is contained in:
2026-02-10 21:33:11 +01:00
parent 0c2be26cf0
commit 48708436df

View File

@@ -26,6 +26,7 @@ from prompt_toolkit.shortcuts import checkboxlist_dialog
from prompt_toolkit.shortcuts import radiolist_dialog from prompt_toolkit.shortcuts import radiolist_dialog
def setup_vault():
# VAULT_ADDR = os.environ.get("VAULT_ADDR", "http://192.168.77.101:8200") # VAULT_ADDR = os.environ.get("VAULT_ADDR", "http://192.168.77.101:8200")
VAULT_ADDR = os.environ.get("VAULT_ADDR", "https://vault.sectorq.eu") VAULT_ADDR = os.environ.get("VAULT_ADDR", "https://vault.sectorq.eu")
try: try:
@@ -36,13 +37,14 @@ except KeyError:
VAULT_TOKEN = prompt("Valult root token : ", is_password=True) VAULT_TOKEN = prompt("Valult root token : ", is_password=True)
os.environ["VAULT_TOKEN"] = VAULT_TOKEN os.environ["VAULT_TOKEN"] = VAULT_TOKEN
client = hvac.Client(url=VAULT_ADDR, token=VAULT_TOKEN) vclient = hvac.Client(url=VAULT_ADDR, token=VAULT_TOKEN)
# Check if connected # Check if connected
if client.is_authenticated(): if vclient.is_authenticated():
print("Connected to Vault") print("Connected to Vault")
else: else:
raise Exception("Failed to authenticate with Vault") raise Exception("Failed to authenticate with Vault")
# Specify the mount point of your KV engine # Specify the mount point of your KV engine
return vclient
VERSION = "0.1.55" VERSION = "0.1.55"
@@ -158,7 +160,8 @@ parser.add_argument(
args = parser.parse_args() args = parser.parse_args()
print("Running version:", VERSION) print("Running version:", VERSION)
print("Environment:", args.site) print("Environment:", args.site)
args.client = client
args.client = setup_vault()
if args.site is not None: if args.site is not None:
cur_config["PORTAINER_SITE"] = args.site cur_config["PORTAINER_SITE"] = args.site
if args.endpoint_id is not None: if args.endpoint_id is not None: