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
|
from prompt_toolkit.shortcuts import radiolist_dialog
|
||||||
|
|
||||||
|
|
||||||
# VAULT_ADDR = os.environ.get("VAULT_ADDR", "http://192.168.77.101:8200")
|
def setup_vault():
|
||||||
VAULT_ADDR = os.environ.get("VAULT_ADDR", "https://vault.sectorq.eu")
|
# VAULT_ADDR = os.environ.get("VAULT_ADDR", "http://192.168.77.101:8200")
|
||||||
try:
|
VAULT_ADDR = os.environ.get("VAULT_ADDR", "https://vault.sectorq.eu")
|
||||||
VAULT_TOKEN = os.environ.get("VAULT_TOKEN")
|
try:
|
||||||
if VAULT_TOKEN is None:
|
VAULT_TOKEN = os.environ.get("VAULT_TOKEN")
|
||||||
raise KeyError
|
if VAULT_TOKEN is None:
|
||||||
except KeyError:
|
raise KeyError
|
||||||
VAULT_TOKEN = prompt("Valult root token : ", is_password=True)
|
except KeyError:
|
||||||
os.environ["VAULT_TOKEN"] = VAULT_TOKEN
|
VAULT_TOKEN = prompt("Valult root token : ", is_password=True)
|
||||||
|
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:
|
||||||
|
|||||||
Reference in New Issue
Block a user