mirror of
https://gitlab.sectorq.eu/jaydee/portainer.git
synced 2026-03-14 23:00:01 +01:00
build
This commit is contained in:
37
main.py
37
main.py
@@ -26,23 +26,25 @@ from prompt_toolkit.shortcuts import checkboxlist_dialog
|
||||
from prompt_toolkit.shortcuts import radiolist_dialog
|
||||
|
||||
|
||||
# VAULT_ADDR = os.environ.get("VAULT_ADDR", "http://192.168.77.101:8200")
|
||||
VAULT_ADDR = os.environ.get("VAULT_ADDR", "https://vault.sectorq.eu")
|
||||
try:
|
||||
VAULT_TOKEN = os.environ.get("VAULT_TOKEN")
|
||||
if VAULT_TOKEN is None:
|
||||
raise KeyError
|
||||
except KeyError:
|
||||
VAULT_TOKEN = prompt("Valult root token : ", is_password=True)
|
||||
os.environ["VAULT_TOKEN"] = VAULT_TOKEN
|
||||
def setup_vault():
|
||||
# VAULT_ADDR = os.environ.get("VAULT_ADDR", "http://192.168.77.101:8200")
|
||||
VAULT_ADDR = os.environ.get("VAULT_ADDR", "https://vault.sectorq.eu")
|
||||
try:
|
||||
VAULT_TOKEN = os.environ.get("VAULT_TOKEN")
|
||||
if VAULT_TOKEN is None:
|
||||
raise KeyError
|
||||
except KeyError:
|
||||
VAULT_TOKEN = prompt("Valult root token : ", is_password=True)
|
||||
os.environ["VAULT_TOKEN"] = VAULT_TOKEN
|
||||
|
||||
client = hvac.Client(url=VAULT_ADDR, token=VAULT_TOKEN)
|
||||
# Check if connected
|
||||
if client.is_authenticated():
|
||||
print("Connected to Vault")
|
||||
else:
|
||||
raise Exception("Failed to authenticate with Vault")
|
||||
# Specify the mount point of your KV engine
|
||||
vclient = hvac.Client(url=VAULT_ADDR, token=VAULT_TOKEN)
|
||||
# Check if connected
|
||||
if vclient.is_authenticated():
|
||||
print("Connected to Vault")
|
||||
else:
|
||||
raise Exception("Failed to authenticate with Vault")
|
||||
# Specify the mount point of your KV engine
|
||||
return vclient
|
||||
|
||||
VERSION = "0.1.55"
|
||||
|
||||
@@ -158,7 +160,8 @@ parser.add_argument(
|
||||
args = parser.parse_args()
|
||||
print("Running version:", VERSION)
|
||||
print("Environment:", args.site)
|
||||
args.client = client
|
||||
|
||||
args.client = setup_vault()
|
||||
if args.site is not None:
|
||||
cur_config["PORTAINER_SITE"] = args.site
|
||||
if args.endpoint_id is not None:
|
||||
|
||||
Reference in New Issue
Block a user