allow_domains on redis storage
shimsag opened this issue · comments
shimsag commented
Hi ,
I developed a multi-tenancy application which allows my tenants to use their arbitrary domains (in addition to the subdomain I provide).
We will use redis storage adapter for ssl certificates generated by resty-auto-ssl but I would also like to make a whitelist of domains on my redis server instead of a txt file.
Is it possible ? Can anyone show me an example of how it should be done ?
Deleted user commented
we've used this :
auto_ssl:set("allow_domain", function(domain, auto_ssl, ssl_options, renewal)
local redis_instance, instance_err = auto_ssl.storage.adapter:get_connection()
if instance_err then
return nil, instance_err
end
-- if there's a key in redis "www.foo.bar" with any value, allow it
local res, err = redis_instance:get(domain)
if res == ngx.null then
return false
else
return true
end
end)
shimsag commented
we've used this :
auto_ssl:set("allow_domain", function(domain, auto_ssl, ssl_options, renewal) local redis_instance, instance_err = auto_ssl.storage.adapter:get_connection() if instance_err then return nil, instance_err end -- if there's a key in redis "www.foo.bar" with any value, allow it local res, err = redis_instance:get(domain) if res == ngx.null then return false else return true end end)
Thank you so much !!