Add flag to disable update checks

This commit is contained in:
Matthew Wild 2021-02-02 13:58:02 +00:00
parent 5e0b8c9e7d
commit 4cc3880ec7
2 changed files with 11 additions and 3 deletions

View File

@ -162,8 +162,11 @@ software_name = "Snikket"
update_notify_version_url = "https://snikket.org/updates/{branch}/{version}"
update_notify_support_url = "https://snikket.org/notices/{branch}/"
update_notify_message_url = "https://snikket.org/notices/{branch}/{message}"
update_check_dns = "_{branch}.update.snikket.net"
update_check_interval = 21613 -- ~6h
if ENV_SNIKKET_UPDATE_CHECK ~= "0" then
update_check_dns = "_{branch}.update.snikket.net"
update_check_interval = 21613 -- ~6h
end
http_default_host = DOMAIN
http_host = DOMAIN

View File

@ -20,6 +20,7 @@ do
end
function check_for_updates()
if not update_dns then return; end
local record_name = render_hostname(update_dns, version_info);
module:log("debug", "Checking for updates on %s...", record_name);
r:lookup(function (records)
@ -43,5 +44,9 @@ function check_for_updates()
end
function module.load()
module:add_timer(5, check_for_updates);
if update_dns then
module:add_timer(5, check_for_updates);
else
module:log("warn", "Update notifications are disabled");
end
end