This commit is contained in:
parent
a1ec2c1602
commit
ee7a0b7f63
@ -11,8 +11,9 @@ class AddSubPathCommand(Command):
|
|||||||
self.printUsage()
|
self.printUsage()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
router = args[0]
|
||||||
domain = args[1]
|
domain = args[1]
|
||||||
name = args[0] + "-sub-path-" + domain
|
subPathName = args[0] + "-sub-path-" + domain
|
||||||
path = args[2]
|
path = args[2]
|
||||||
serviceHost = args[3]
|
serviceHost = args[3]
|
||||||
|
|
||||||
@ -20,12 +21,12 @@ class AddSubPathCommand(Command):
|
|||||||
if path.startswith("/") == False:
|
if path.startswith("/") == False:
|
||||||
path = "/" + path
|
path = "/" + path
|
||||||
|
|
||||||
if traefikConfig.hasPathRewrite(name):
|
if traefikConfig.hasPathRewrite(subPathName):
|
||||||
print(f"Router \"{name}\" already exists")
|
print(f"Path rewrite already exists for \"{router}\"")
|
||||||
return
|
return
|
||||||
|
|
||||||
if traefikConfig.hasRouter(name) == False:
|
if traefikConfig.hasRouter(router) == False:
|
||||||
print(f"Router \"{name}\" does not exist")
|
print(f"Router \"{router}\" does not exist")
|
||||||
return
|
return
|
||||||
|
|
||||||
# Validate if the service host is a valid URL
|
# Validate if the service host is a valid URL
|
||||||
@ -35,7 +36,7 @@ class AddSubPathCommand(Command):
|
|||||||
|
|
||||||
print(f"Adding \"{domain}\" -> \"{serviceHost}\"")
|
print(f"Adding \"{domain}\" -> \"{serviceHost}\"")
|
||||||
|
|
||||||
traefikConfig.addSubPathRouter(name, domain, path, serviceHost)
|
traefikConfig.addSubPathRouter(subPathName, domain, path, serviceHost)
|
||||||
traefikConfig.save()
|
traefikConfig.save()
|
||||||
|
|
||||||
print(f"Access your service at http://{domain}")
|
print(f"Access your service at http://{domain}")
|
Loading…
Reference in New Issue
Block a user