mirror of
https://gitlab.sectorq.eu/jaydee/portainer.git
synced 2025-12-14 10:44:52 +01:00
build
This commit is contained in:
7
port.py
7
port.py
@@ -12,6 +12,7 @@ import base64
|
||||
import tabulate
|
||||
from git import Repo
|
||||
import requests
|
||||
import hvac
|
||||
from prompt_toolkit import prompt
|
||||
from prompt_toolkit.completion import WordCompleter
|
||||
from prompt_toolkit.shortcuts import checkboxlist_dialog
|
||||
@@ -126,10 +127,12 @@ class Portainer:
|
||||
self.base_url = os.getenv(
|
||||
"PORTAINER_URL", "https://portainer.sectorq.eu/api"
|
||||
)
|
||||
self.token = "ptr_GCNUoFcTOaXm7k8ZxPdQGmrFIamxZPTydbserYofMHc="
|
||||
# self.token = "ptr_GCNUoFcTOaXm7k8ZxPdQGmrFIamxZPTydbserYofMHc="
|
||||
token_path = "portainer/token"
|
||||
self.token = self.args.client.secrets.kv.v1.read_secret(path=token_path)['data']['value']
|
||||
input(self.token)
|
||||
elif site == "port":
|
||||
self.base_url = os.getenv("PORTAINER_URL", "https://port.sectorq.eu/api")
|
||||
self.token = "ptr_/5RkMCT/j3BTaL32vMSDtXFi76yOXRKVFOrUtzMsl5Y="
|
||||
else:
|
||||
self.base_url = os.getenv(
|
||||
"PORTAINER_URL", "https://portainer.sectorq.eu/api"
|
||||
|
||||
16
portainer.py
16
portainer.py
@@ -14,6 +14,7 @@ import json
|
||||
import argparse
|
||||
import tty
|
||||
import termios
|
||||
import hvac
|
||||
from tabulate import tabulate
|
||||
from port import Portainer
|
||||
from prompt_toolkit import prompt
|
||||
@@ -21,6 +22,17 @@ from prompt_toolkit.completion import WordCompleter
|
||||
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_TOKEN = os.environ.get("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
|
||||
|
||||
VERSION = "0.1.13"
|
||||
|
||||
defaults = {
|
||||
@@ -34,8 +46,6 @@ defaults = {
|
||||
|
||||
cur_config = {}
|
||||
|
||||
|
||||
|
||||
def load_config(defaults=defaults):
|
||||
'''Load configuration from /myapps/portainer.conf if it exists, else from env vars or defaults.'''
|
||||
if os.path.exists("/myapps/portainer.conf"):
|
||||
@@ -130,7 +140,7 @@ parser.add_argument("--stack-mode", "-w", default=None, help="Stack mode")
|
||||
args = parser.parse_args()
|
||||
print("Running version:", VERSION)
|
||||
print("Environment:", args.site)
|
||||
|
||||
args.client = client
|
||||
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