Commit 884cbcc5 authored by Sebastian Macarescu's avatar Sebastian Macarescu
Browse files

add basic redis

parent cfca129c
*.sh text eol=lf
\ No newline at end of file
......@@ -7,6 +7,10 @@ ENV DIFFIE_HELLMAN='' \
FORCE_HTTPS='true' \
SITES='' \
LETSENCRYPT_URL='https://acme-v02.api.letsencrypt.org/directory' \
STORAGE_ADAPTER='file' \
REDIS_HOST='' \
REDIS_DB='' \
REDIS_KEY_PREFIX='' \
RESOLVER_ADDRESS='8.8.8.8'
# Here we install open resty and generate dhparam.pem file.
......
......@@ -59,7 +59,7 @@ fi
# let's substitute $ALLOWED_DOMAINS, $LETSENCRYPT_URL and $RESOLVER_ADDRESS into OpenResty configuration
envsubst '$ALLOWED_DOMAINS,$LETSENCRYPT_URL,$RESOLVER_ADDRESS' \
envsubst '$ALLOWED_DOMAINS,$LETSENCRYPT_URL,$RESOLVER_ADDRESS,$STORAGE_ADAPTER,$REDIS_HOST,$REDIS_DB,$REDIS_KEY_PREFIX' \
< ${RESTY_CONF_DIR}/resty-http.conf \
> ${RESTY_CONF_DIR}/resty-http.conf.copy \
&& mv ${RESTY_CONF_DIR}/resty-http.conf.copy ${RESTY_CONF_DIR}/resty-http.conf
......
# The "auto_ssl" shared dict should be defined with enough storage space to
# hold your certificate data. 1MB of storage holds certificates for
# approximately 100 separate domains.
lua_shared_dict auto_ssl 1m;
lua_shared_dict auto_ssl 10m;
# The "auto_ssl" shared dict is used to temporarily store various settings
# like the secret used by the hook server on port 8999. Do not change or
......@@ -27,6 +27,15 @@ init_by_lua_block {
return ngx.re.match(domain, '$ALLOWED_DOMAINS', 'ijo')
end)
if "$STORAGE_ADAPTER" == "redis" then
auto_ssl:set("storage_adapter", "resty.auto-ssl.storage_adapters.redis")
auto_ssl:set("redis", {
host = "$REDIS_HOST",
db = "$REDIS_DB",
prefix = "$REDIS_KEY_PREFIX"
})
end
auto_ssl:init()
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment