#1786 only allow one letsencrypt subscription at a time (#1787)

This commit is contained in:
Christian Rotzoll
2020-11-19 01:24:15 +01:00
committed by rootzoll
parent 0dfa3fce4d
commit 226f14e8c6

View File

@@ -208,6 +208,15 @@ def dynu_update(domain, token, ip):
#####################
def subscriptions_new(ip, dnsservice, domain, token, target):
# check if already one subscrption exists (limit to just one)
# https://github.com/rootzoll/raspiblitz/issues/1786
if Path(SUBSCRIPTIONS_FILE).is_file():
subs = toml.load(SUBSCRIPTIONS_FILE)
if "subscriptions_letsencrypt" in subs:
if len(subs['subscriptions_letsencrypt']) > 0:
raise BlitzError("not more than one letsencrypt subscription", "cancel existing letsencrypt first")
# domain needs to be the full domain name
if domain.find(".") == -1:
raise BlitzError("not a fully qualified domain name", domain)