use constants in tier defaults

This commit is contained in:
Karol Wypchlo 2022-03-03 19:13:38 +01:00
parent ccee4be9a8
commit 30e8c886b9
No known key found for this signature in database
GPG Key ID: B515DE9EEBE241E1
1 changed files with 20 additions and 6 deletions

View File

@ -1,16 +1,30 @@
local _M = {} local _M = {}
-- fallback - remember to keep those updated
local anon_limits = { ["tierID"] = 0, ["tierName"] = "anonymous", ["upload"] = 655360, ["download"] = 655360, ["maxUploadSize"] = 1073741824, ["registry"] = 250 }
-- no limits applied
local no_limits = { ["tierID"] = -1, ["tierName"] = "internal", ["upload"] = 0, ["download"] = 0, ["maxUploadSize"] = 0, ["registry"] = 0 }
-- constant tier ids -- constant tier ids
local tier_id_internal = -1 local tier_id_internal = -1
local tier_id_anonymous = 0 local tier_id_anonymous = 0
local tier_id_free = 1 local tier_id_free = 1
-- fallback - remember to keep those updated
local anon_limits = {
["tierID"] = tier_id_anonymous,
["tierName"] = "anonymous",
["upload"] = 655360,
["download"] = 655360,
["maxUploadSize"] = 1073741824,
["registry"] = 250
}
-- no limits applied
local no_limits = {
["tierID"] = tier_id_internal,
["tierName"] = "internal",
["upload"] = 0,
["download"] = 0,
["maxUploadSize"] = 0,
["registry"] = 0
}
-- handle request exit when access to portal should be restricted to authenticated users only -- handle request exit when access to portal should be restricted to authenticated users only
function _M.exit_access_unauthorized(message) function _M.exit_access_unauthorized(message)
ngx.status = ngx.HTTP_UNAUTHORIZED ngx.status = ngx.HTTP_UNAUTHORIZED