fixes
All checks were successful
Publish Docker Image / docker (push) Successful in 58s

This commit is contained in:
Lee 2024-08-28 02:53:53 +01:00
parent 304451ef7c
commit 6430dc5bc4
3 changed files with 33 additions and 2 deletions

View File

@ -13,16 +13,16 @@ class AddSubPathCommand(Command):
router = args[0]
domain = args[1]
subPathName = args[0] + "-sub-path-" + domain
path = args[2]
serviceHost = args[3]
subPathName = "strip-" + router + "-" + path + "-prefix"
# Fix the path
if path.startswith("/") == False:
path = "/" + path
if traefikConfig.hasPathRewrite(subPathName):
print(f"Path rewrite already exists for \"{router}\"")
print(f"Sub path for \"{router}\" already exists")
return
if traefikConfig.hasRouter(router) == False:

View File

@ -0,0 +1,27 @@
from colorama import Fore
from command.command import Command
from traefik.traefikConfig import TraefikConfig
from utils.dockerUtils import restartTraefik
class RemoveCommand(Command):
def __init__(self):
super().__init__("remove-sub-path", "Remove sub path from a domain", "remove-sub-path <name> <path>")
def execute(self, traefikConfig: TraefikConfig, args):
if len(args) < 0:
self.printUsage()
return
name = args[0]
if not traefikConfig.hasRouter(name):
print(f"Router \"{name}\" does not exist")
return
print(f"Removing \"{name}\"")
traefikConfig.removeRouter(name)
traefikConfig.save()
restartTraefik()

View File

@ -50,6 +50,10 @@ class TraefikConfig:
"service": name
}
# Add trailing slash
if not serviceHost.endswith("/"):
serviceHost += "/"
# Add service
self.configYml["http"]["services"][name] = {
"loadBalancer": {