diff options
| -rwxr-xr-x | renew-all | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -10,6 +10,7 @@ import tomllib parser = argparse.ArgumentParser() parser.add_argument("--env", required=True, choices=["prod", "nonprod"]) +parser.add_argument("action", default="renew", nargs="?", choices=["renew", "run"]) args = parser.parse_args() @@ -27,6 +28,19 @@ def main() -> None: for subdomain in subdomain_list for request in ("--domains", subdomain) ] + actions = { + "renew": [ + "renew", + "--reuse-key", + "--days", + str(domain["renew_days"]), + "--renew-hook", + domain[f"renew_script_{args.env}"], + ], + "run": [ + "run", + ], + } command = ( [ "lego", @@ -40,14 +54,7 @@ def main() -> None: "--dns.disable-cp", ] + subdomain_requests - + [ - "renew", - "--reuse-key", - "--days", - str(domain["renew_days"]), - "--renew-hook", - domain[f"renew_script_{args.env}"], - ] + + actions[args.action] ) environment = { "DESEC_POLLING_INTERVAL": str(config["timeout_seconds"]), |
