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,27 +103,26 @@ 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]
# Host # Get service host
if rule.startswith("Host"): serviceHost = services[name]["loadBalancer"]["servers"][0]["url"]
domain = rule.split("`")[1]
domains[domain] = services[name]["loadBalancer"]["servers"][0]["url"]
# HostRegexp # Add to domains
if rule.startswith("HostRegexp"): domains[name] = {
domain = rule.split("`")[1] "domain": domain,
domains[domain] = services[name]["loadBalancer"]["servers"][0]["url"] "serviceHost": serviceHost
}
# 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))