started work on moving variables from .lua to nginx

This commit is contained in:
bunkerity
2021-05-18 15:14:45 +02:00
parent 600484b16e
commit 863283d090
14 changed files with 177 additions and 25 deletions

View File

@@ -7,10 +7,11 @@ location ~ ^%API_URI% {
rewrite_by_lua_block {
local api = require "api"
local api_uri = "%API_URI%"
local api = require "api"
local api_whitelist_ip = {%API_WHITELIST_IP%}
local api_uri = "%API_URI%"
if api.is_api_call(api_uri) then
if api.is_api_call(api_uri, api_whitelist_ip) then
ngx.header.content_type = 'text/plain'
if api.do_api_call(api_uri) then
ngx.log(ngx.NOTICE, "[API] API call " .. ngx.var.request_uri .. " successfull from " .. ngx.var.remote_addr)

View File

@@ -1,9 +1,10 @@
rewrite_by_lua_block {
local api = require "api"
local api_uri = "%API_URI%"
local api = require "api"
local api_whitelist_ip = {%API_WHITELIST_IP%}
local api_uri = "%API_URI%"
if api.is_api_call(api_uri) then
if api.is_api_call(api_uri, api_whitelist_ip) then
ngx.header.content_type = 'text/plain'
if api.do_api_call(api_uri) then
ngx.log(ngx.NOTICE, "[API] API call " .. ngx.var.request_uri .. " successfull from " .. ngx.var.remote_addr)