Last active
April 19, 2020 15:54
-
-
Save leandromoreira/a84b7e858da5271a12edd75022bb13f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http { | |
init_by_lua_block { | |
config = "redis-cluster-config" | |
redis_cluster = require "resty-redis-cluster" | |
edge_computing = require "resty-edge-computing" | |
} | |
server { | |
listen 8080; | |
location /platform { | |
alias /usr/local/openresty/nginx/; | |
} | |
rewrite_by_lua_block { | |
local redis_client = redis_cluster:new(config) | |
local status, err = edge_computing.start(redis_client) | |
if not status then | |
ngx.log(ngx.ERR, " edge_computing.start error ", err) | |
end | |
} | |
access_by_lua_block { | |
local status, errs = edge_computing.execute() | |
if errs ~= {} then | |
for _, err in ipairs(errs) do | |
ngx.log(ngx.ERR, " edge_computing.execute error ", err) | |
end | |
end | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment