print service name in the list command
All checks were successful
Publish Docker Image / docker (push) Successful in 1m12s

This commit is contained in:
Lee 2024-01-13 21:03:40 +00:00
parent d9c0cb746a
commit bf58d43b8a

@ -103,28 +103,27 @@ def removeDomain(name):
def listDomains(): def listDomains():
print("Listing domains:") print("Listing domains:")
# domain -> service host # name and domain -> service host
domains = {} domains = {}
# Get domains (Host and HostRegexp) # Loop through routers
for name, router in routers.items(): for name, router in routers.items():
if "rule" in router: # Get domain
rule = router["rule"] domain = router["rule"].split("`")[1]
# Get service host
serviceHost = services[name]["loadBalancer"]["servers"][0]["url"]
# Host # Add to domains
if rule.startswith("Host"): domains[name] = {
domain = rule.split("`")[1] "domain": domain,
domains[domain] = services[name]["loadBalancer"]["servers"][0]["url"] "serviceHost": serviceHost
}
# HostRegexp
if rule.startswith("HostRegexp"):
domain = rule.split("`")[1]
domains[domain] = services[name]["loadBalancer"]["servers"][0]["url"]
# Print domains # Print domains
for domain, serviceHost in domains.items(): for name, domain in domains.items():
print(" - http://%s -> %s" % (domain, serviceHost)) print(" - [%s] http://%s -> %s" % (name, domain["domain"], domain["serviceHost"]))
print("") print("")
print("Total: %s" % len(domains)) print("Total: %s" % len(domains))