Skip to content

Commit

Permalink
lua-resty-auto-ssl-storage-adapter-consul (#25): created var alb_use_…
Browse files Browse the repository at this point in the history
…consul
  • Loading branch information
fititnt committed Nov 28, 2019
1 parent f43b779 commit dab478a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ alb_manange_haproxy: yes
alb_manange_openresty: yes
alb_manange_ufw: no

alb_use_consul: no

## Optionated (but NOT required) group of tasks.
alb_manange_common: no # hostname, timezone (UTC) [See tasks/common/common.yml]

Expand Down
9 changes: 6 additions & 3 deletions files/resty/auto-ssl/storage_adapters/consul.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
-- License: Public Domain

------- How to test:
-- Copy this file to /usr/local/share/lua/5.1/resty/auto-ssl/storage_adapters/consul.lua. With ansible would be:
-- ansible -m copy -a "src=./consul.lua dest=/usr/local/share/lua/5.1/resty/auto-ssl/storage_adapters/consul.lua" aguia-pescadora-delta.etica.ai,aguia-pescadora-echo.etica.ai,aguia-pescadora-foxtrot.etica.ai
-- Them set the following on your OpenResty, at http context
-- auto_ssl:set("storage_adapter", "resty.auto-ssl.storage_adapters.consul")


-- lua files/resty/auto-ssl/storage_adapters/consul.lua
print ('teste 123')

-- How to document Lua code:
Expand Down Expand Up @@ -66,6 +71,4 @@ end
function _M.setup_worker(self)
end



return _M
1 change: 1 addition & 0 deletions files/resty/auto-ssl/storage_adapters/test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ function solve (a,b,c)
(-b - disc)/2*a
end
end

4 changes: 4 additions & 0 deletions templates/openresty/nginx/conf/nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ http {
init_by_lua_block {
auto_ssl = (require "resty.auto-ssl").new()

{% if (alb_use_consul|bool) %}
auto_ssl:set("storage_adapter", "resty.auto-ssl.storage_adapters.consul")
{% endif %}

{% if alb_letsencrypt_acmeurl_custom is defined %}
auto_ssl:set("ca", "{{ alb_letsencrypt_acmeurl_custom }}")
{% endif %}
Expand Down

0 comments on commit dab478a

Please sign in to comment.