Skip to content

Instantly share code, notes, and snippets.

@leandromoreira
Last active April 19, 2020 15:54
Show Gist options
  • Save leandromoreira/a84b7e858da5271a12edd75022bb13f6 to your computer and use it in GitHub Desktop.
Save leandromoreira/a84b7e858da5271a12edd75022bb13f6 to your computer and use it in GitHub Desktop.
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