~torresjrjr/linkchanbot

f5563d2151fb49ea935c1da67ed080b431530e9f — Byron Torres 3 years ago a18ac43
Validate alts.json, warn of missing 'service'
1 files changed, 8 insertions(+), 1 deletions(-)

M linkchanbot
M linkchanbot => linkchanbot +8 -1
@@ 177,6 177,13 @@ def init(args):
        )
        exit(1)

    # Validate ALTS
    for altsite, alt in ALTS.items():
        if 'service' not in alt:
            logging.warning(
                f"alts.json: '{altsite}' has no 'service' value, ignored"
            )

    return TOKEN, ADMIN, LOGFILE




@@ 285,7 292,7 @@ def mk_newlinks(link):
    # Find alts for replacing `service`
    applicable_alts = {
        altsite: alt for (altsite, alt) in ALTS.items()
        if alt['service'] == service
        if alt.get('service') == service
    }

    # Make new substitutes