changeset 5155:18ed655c755d

mod_unified_push: Make unified_push_secret only required for jwt backend
author Matthew Wild <mwild1@gmail.com>
date Sat, 14 Jan 2023 17:59:29 +0000
parents 48ca519cd66a
children a8df4d2447d0
files mod_unified_push/mod_unified_push.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_unified_push/mod_unified_push.lua	Sat Jan 14 16:16:47 2023 +0000
+++ b/mod_unified_push/mod_unified_push.lua	Sat Jan 14 17:59:29 2023 +0000
@@ -1,4 +1,4 @@
-local unified_push_secret = assert(module:get_option_string("unified_push_secret"), "required option: unified_push_secret");
+local unified_push_secret = module:get_option_string("unified_push_secret");
 local push_registration_ttl = module:get_option_number("unified_push_registration_ttl", 86400);
 
 local base64 = require "util.encodings".base64;
@@ -104,6 +104,8 @@
 
 local backend = module:get_option_string("unified_push_backend", backends.paseto and "paseto" or "storage");
 
+assert(backend ~= "jwt" or unified_push_secret, "required option missing: unified_push_secret");
+
 local function register_route(params)
 	local expiry = os.time() + push_registration_ttl;
 	local token, err = backends[backend].sign({