Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sunkan/lua-resty-mogilefs
https://github.com/sunkan/lua-resty-mogilefs
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sunkan/lua-resty-mogilefs
- Owner: sunkan
- Created: 2017-02-06T11:49:23.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-08T09:30:54.000Z (almost 8 years ago)
- Last Synced: 2024-02-14T19:33:36.985Z (9 months ago)
- Language: Lua
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
- awesome-resty - lua-resty-mogilefs
README
Name
====lua-resty-mogilefs - Lua mogilefs client driver for the ngx_lua based on the cosocket API
##Small example
```
location / {
set $path "";
rewrite_by_lua '
local domain = "example.com"
local key = ngx.var.urilocal mogilefs = require "resty.mogilefs"
local mogile, err = mogilefs:new()
if not mogile then
ngx.say("error to instantiate mogile: ", err)
return
endmogile:set_timeout(1000) -- 1 sec
local ok, err = mogile:connect("127.0.0.1", 7001)
if not ok then
ngx.say("failed to connect: ", err)
return
endlocal path, pathCount, err = mogile:get(domain, key)
if err then
ngx.status = ngx.HTTP_NOT_FOUND
return
endngx.var.path = path
';
proxy_pass $path;
}
```