mirror of
https://gitlab.sectorq.eu/jaydee/portainer.git
synced 2025-12-14 18:44:53 +01:00
build
This commit is contained in:
10
portainer.py
10
portainer.py
@@ -13,6 +13,7 @@ import logging
|
||||
parser = argparse.ArgumentParser(description="Portainer helper - use env vars or pass credentials.")
|
||||
parser.add_argument("--base", "-b", default=os.getenv("PORTAINER_URL", "https://portainer.example.com"),
|
||||
help="Base URL for Portainer (ENV: PORTAINER_URL)")
|
||||
parser.add_argument("--site", "-t", type=str, default="portainer", help="Site")
|
||||
parser.add_argument("--endpoint-id", "-e", type=str, default="all", help="Endpoint ID to limit stack operations")
|
||||
parser.add_argument("--refresh-environment", "-R", action="store_true", help="List endpoints")
|
||||
parser.add_argument("--list-endpoints","-E", action="store_true", help="List endpoints")
|
||||
@@ -56,7 +57,13 @@ logging.info("script started")
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
portainer_api_key = "ptr_GCNUoFcTOaXm7k8ZxPdQGmrFIamxZPTydbserYofMHc="
|
||||
if args.site == "portainer":
|
||||
base = os.getenv("PORTAINER_URL", "https://portainer.sectorq.eu/api")
|
||||
portainer_api_key = "ptr_GCNUoFcTOaXm7k8ZxPdQGmrFIamxZPTydbserYofMHc="
|
||||
else:
|
||||
base = os.getenv("PORTAINER_URL", "https://port.sectorq.eu/api")
|
||||
portainer_api_key = "ptr_/5RkMCT/j3BTaL32vMSDtXFi76yOXRKVFOrUtzMsl5Y="
|
||||
|
||||
def wl(msg):
|
||||
if args.debug:
|
||||
print(msg)
|
||||
@@ -91,7 +98,6 @@ def get_portainer_token(base_url, username=None, password=None, timeout=10):
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Example usage: set PORTAINER_USER and PORTAINER_PASS in env, or pass literals below.
|
||||
base = os.getenv("PORTAINER_URL", "https://portainer.sectorq.eu/api")
|
||||
#token = get_portainer_token(base,"admin","l4c1j4yd33Du5lo") # or get_portainer_token(base, "admin", "secret")
|
||||
token = portainer_api_key
|
||||
# Example: list endpoints
|
||||
|
||||
Reference in New Issue
Block a user