From 702cb85df8798954737c93a4bd978d9a711ed343 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Thu, 11 Apr 2024 11:17:58 -0600 Subject: add acme script --- args.py | 52 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 11 deletions(-) (limited to 'args.py') diff --git a/args.py b/args.py index b4d70d5..a3f400d 100644 --- a/args.py +++ b/args.py @@ -4,26 +4,56 @@ import argparse def get_args(): parser = argparse.ArgumentParser() - parser.add_argument("--endpoint", default="https://hatecomputers.club") - parser.add_argument("--api-key-file", default="apikey.secret") + parser.add_argument( + "--endpoint", default="https://hatecomputers.club", help="API endpoint" + ) + parser.add_argument( + "--api-key-file", + default="apikey.secret", + help="path to file containing the API key", + ) parser.add_argument( "--log-level", default="INFO", choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], ) - parser.add_argument("--certbot", action="store_true", default=False) - parser.add_argument("--acme-url", required=False) - parser.add_argument("--acme-storage", default="acme.json") + parser.add_argument( + "--public-suffixes", + default="hatecomputers.club", + help="comma separated list of public suffixes", + ) + parser.add_argument( + "--dns-propogate-time", + default=20, + type=int, + help="time to sleep to allow DNS to propogate", + ) + parser.add_argument( + "--certbot", action="store_true", default=False, help="enable certbot mode" + ) + parser.add_argument( + "--certbot-domain", required=False, help="splat/domain to validate with certbot" + ) + parser.add_argument( + "--certbot-validation", required=False, help="validation token for certbot" + ) - parser.add_argument("--sync", action="store_true", default=False) - parser.add_argument("--records-file", default="records.json") + parser.add_argument( + "--create", + action="store_true", + default=False, + help="upload records file to API to sync", + ) + parser.add_argument("--records-file", default="records.json", help="records file") args = parser.parse_args() - if (args.certbot) and (not args.acme_url): - parser.error("--acme-url is required when --certbot is used") - if (args.certbot) and (args.sync): - parser.error("--sync cannot be used in combination with --certbot") + if (args.certbot) and (not args.certbot_domain): + parser.error("--certbot-domain is required when --certbot is used") + if (args.certbot) and (not args.certbot_validation): + parser.error("--certbot-validation is required when --certbot is used") + if args.certbot: + args.public_suffixes = args.public_suffixes.split(",") return args -- cgit v1.3