2024-01-13 19:37:10 +00:00
|
|
|
import sys
|
2024-01-13 19:51:28 +00:00
|
|
|
import os
|
2024-01-15 22:59:08 +00:00
|
|
|
|
|
|
|
from command.commandManager import CommandManager
|
|
|
|
from traefik.traefikConfig import TraefikConfig
|
2024-01-13 19:37:10 +00:00
|
|
|
|
|
|
|
# Variables
|
2024-01-13 19:51:28 +00:00
|
|
|
configFile = "./config.yml"
|
|
|
|
|
|
|
|
# Are we running in a Docker container?
|
|
|
|
if os.environ.get("CONFIG_FILE"):
|
|
|
|
configFile = os.environ.get("CONFIG_FILE")
|
2024-01-13 19:37:10 +00:00
|
|
|
|
2024-01-15 22:59:08 +00:00
|
|
|
traefikConfig = TraefikConfig(configFile)
|
|
|
|
if traefikConfig.isValid() == False:
|
|
|
|
print("Invalid traefik config file, please check your config.yml file")
|
|
|
|
exit(1)
|
|
|
|
|
2024-01-13 19:37:10 +00:00
|
|
|
command = len(sys.argv) > 1 and sys.argv[1]
|
2024-01-15 22:59:08 +00:00
|
|
|
commandManager = CommandManager()
|
2024-01-13 19:37:10 +00:00
|
|
|
|
2024-01-15 22:59:08 +00:00
|
|
|
if not commandManager.commandExists(command):
|
|
|
|
print("Usage: manage [command]")
|
2024-01-13 19:37:10 +00:00
|
|
|
print("")
|
|
|
|
print("Commands:")
|
2024-01-15 22:59:08 +00:00
|
|
|
for command in commandManager.commands:
|
|
|
|
print(f" - {command.usage}")
|
2024-01-13 19:37:10 +00:00
|
|
|
exit()
|
|
|
|
|
2024-01-15 22:59:08 +00:00
|
|
|
args = sys.argv[2:]
|
|
|
|
commandManager.getCommand(command).execute(traefikConfig, args)
|