mod_external_services: Allow specifying a credential generation callback
authorKim Alvefur <zash@zash.se>
Sat, 25 Jul 2020 12:22:03 +0200
changeset 11043 ec6919401790
parent 11042 efefdf71373b
child 11044 c560531d9a6e
mod_external_services: Allow specifying a credential generation callback This is especially targeted at services added via the items API. More involved credential generation should use the event hook.
plugins/mod_external_services.lua
--- a/plugins/mod_external_services.lua	Sat Jul 25 12:09:19 2020 +0200
+++ b/plugins/mod_external_services.lua	Sat Jul 25 12:22:03 2020 +0200
@@ -84,7 +84,7 @@
 		srv.expires = os.time() + item.ttl;
 	end
 	if (item.secret == true and default_secret) or type(item.secret) == "string" then
-		local secret_cb = algorithms[item.algorithm] or algorithms[srv.type];
+		local secret_cb = item.credentials_cb or algorithms[item.algorithm] or algorithms[srv.type];
 		local secret = item.secret;
 		if secret == true then
 			secret = default_secret;