-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
58 lines (53 loc) · 2.11 KB
/
nginx.conf
File metadata and controls
58 lines (53 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
server {
listen 80 default_server;
server_name _;
client_max_body_size 32M;
client_body_buffer_size 32M;
location ~* ^\/index.php {
content_by_lua_block {
local args = ngx.req.get_uri_args()
module = args["module"]
resource = args["resource"]
action = args["action"]
queryname = args["queryname"]
project_name = args["project_name"]
local res
if resource == "list" then
if queryname == "networks" then
res = ngx.location.capture("/api/v1/neural-networks",
{ args = { api_key = args["api_key"], only_names = "true" }}
)
elseif queryname == "network_info" then
res = ngx.location.capture("/api/v1/neural-networks",
{ args = { api_key = args["api_key"] }}
)
elseif queryname == "projects" then
res = ngx.location.capture("/api/v1/projects",
{ args = { api_key = args["api_key"], only_names = "true" }}
)
elseif queryname == "database" then
if not project_name then
res = ngx.location.capture("/api/v1/projects",
{ args = { api_key = args["api_key"] }}
)
else
res = ngx.location.capture("/api/v1/projects/" .. ngx.unescape_uri(project_name),
{ args = { api_key = args["api_key"] }}
)
end
end
elseif resource == "upload" then
ngx.req.read_body()
local data = ngx.req.get_body_data()
res = ngx.location.capture("/api/v1/cards", {method = ngx.HTTP_POST, body = data})
end
if res then
ngx.say(res.body)
end
}
}
location / {
proxy_pass http://api:8000;
more_clear_input_headers Accept-Encoding;
}
}