From 6cc1575565757aac27f5b94b93b7b5b52673251b Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 24 Aug 2023 22:03:32 +0100 Subject: [PATCH] Sort domains by hostname --- create-nginx-map.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/create-nginx-map.py b/create-nginx-map.py index 8403447..aaa1305 100644 --- a/create-nginx-map.py +++ b/create-nginx-map.py @@ -2,6 +2,7 @@ import requests from typing import NamedTuple import re import sys +import operator TRAEFIK_HOST_RE = re.compile(r"Host\(`([a-z0-9\.-]+)`\)") @@ -61,7 +62,7 @@ def main(): routes.extend(get_traefik_routes("http://10.23.1.103:8080", "http://10.23.1.103")) routes.extend(get_dokku_routes("http://10.23.2.3:8000", "http://10.23.2.3")) - for route in sorted(routes): + for route in sorted(routes, key=operator.attrgetter("hostname")): print(f"{route.hostname}\t{route.destination}; # {route.name}") if __name__ == "__main__":