Reload nginx on completion
This commit is contained in:
parent
09113a4777
commit
0b1d838b78
1 changed files with 12 additions and 0 deletions
|
@ -8,6 +8,7 @@ from collections import defaultdict
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
import subprocess
|
||||||
|
|
||||||
TRAEFIK_HOST_RE = re.compile(r"Host\(`([a-z0-9\.-]+)`\)")
|
TRAEFIK_HOST_RE = re.compile(r"Host\(`([a-z0-9\.-]+)`\)")
|
||||||
|
|
||||||
|
@ -81,6 +82,7 @@ def main():
|
||||||
|
|
||||||
parser.add_argument("--config", "-c", default="./config.toml", type=Path, help="Config file. Default: %(default)s")
|
parser.add_argument("--config", "-c", default="./config.toml", type=Path, help="Config file. Default: %(default)s")
|
||||||
parser.add_argument("--output", "-o", type=Path, default="./map.txt", help="Output file. Default: %(default)s")
|
parser.add_argument("--output", "-o", type=Path, default="./map.txt", help="Output file. Default: %(default)s")
|
||||||
|
parser.add_argument("--reload", action="store_true", help="Reload nginx on completion")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
@ -107,5 +109,15 @@ def main():
|
||||||
|
|
||||||
print("Found", len(routes), "routes, grouped into", len(grouped_routes), "groups")
|
print("Found", len(routes), "routes, grouped into", len(grouped_routes), "groups")
|
||||||
|
|
||||||
|
if args.reload:
|
||||||
|
print("Reloading nginx")
|
||||||
|
subprocess.check_call(
|
||||||
|
[
|
||||||
|
"nginx",
|
||||||
|
"-s",
|
||||||
|
"reload"
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Reference in a new issue