From ee7a0b7f63c00f9b090568dd4ee8cec740c19370 Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 28 Aug 2024 02:42:37 +0100 Subject: [PATCH] fix --- src/command/impl/addSubPathCommand.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/command/impl/addSubPathCommand.py b/src/command/impl/addSubPathCommand.py index a7c0ac2..81f65d2 100644 --- a/src/command/impl/addSubPathCommand.py +++ b/src/command/impl/addSubPathCommand.py @@ -11,8 +11,9 @@ class AddSubPathCommand(Command): self.printUsage() return + router = args[0] domain = args[1] - name = args[0] + "-sub-path-" + domain + subPathName = args[0] + "-sub-path-" + domain path = args[2] serviceHost = args[3] @@ -20,12 +21,12 @@ class AddSubPathCommand(Command): if path.startswith("/") == False: path = "/" + path - if traefikConfig.hasPathRewrite(name): - print(f"Router \"{name}\" already exists") + if traefikConfig.hasPathRewrite(subPathName): + print(f"Path rewrite already exists for \"{router}\"") return - if traefikConfig.hasRouter(name) == False: - print(f"Router \"{name}\" does not exist") + if traefikConfig.hasRouter(router) == False: + print(f"Router \"{router}\" does not exist") return # Validate if the service host is a valid URL @@ -35,7 +36,7 @@ class AddSubPathCommand(Command): print(f"Adding \"{domain}\" -> \"{serviceHost}\"") - traefikConfig.addSubPathRouter(name, domain, path, serviceHost) + traefikConfig.addSubPathRouter(subPathName, domain, path, serviceHost) traefikConfig.save() print(f"Access your service at http://{domain}") \ No newline at end of file