commit f5563d2151fb49ea935c1da67ed080b431530e9f
parent a18ac43c37b569a0725172e1774b6218d522c002
Author: Byron Torres <b@torresjrjr.com>
Date: Mon, 29 Mar 2021 19:09:23 +0100
Validate alts.json, warn of missing 'service'
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/linkchanbot b/linkchanbot
@@ -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