diff options
author | Devaev Maxim <[email protected]> | 2018-11-18 08:11:18 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-11-18 08:11:18 +0300 |
commit | 9762c82d0a6c49f052e2d499a6e54585fde4b0a0 (patch) | |
tree | b9a5e844e4656f77deefe5faa6c46ab5d6fde312 /configs/nginx | |
parent | 51dd9a7428fc0249dd605397ccc955a9fd1cd5cd (diff) |
moved lua crutch to kvmd
Diffstat (limited to 'configs/nginx')
-rw-r--r-- | configs/nginx/apps/.gitignore | 0 | ||||
-rw-r--r-- | configs/nginx/apps/kvm/manifest.json | 8 | ||||
-rw-r--r-- | configs/nginx/nginx.conf | 35 |
3 files changed, 7 insertions, 36 deletions
diff --git a/configs/nginx/apps/.gitignore b/configs/nginx/apps/.gitignore deleted file mode 100644 index e69de29b..00000000 --- a/configs/nginx/apps/.gitignore +++ /dev/null diff --git a/configs/nginx/apps/kvm/manifest.json b/configs/nginx/apps/kvm/manifest.json deleted file mode 100644 index ed19dc67..00000000 --- a/configs/nginx/apps/kvm/manifest.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "KVM", - "description": "Open KVM session in a web browser", - "icon": "/svg/kvm.svg", - "path": "/kvm.html", - "place": 0, - "keyboard_cap": true -} diff --git a/configs/nginx/nginx.conf b/configs/nginx/nginx.conf index 22271d20..ae2703ec 100644 --- a/configs/nginx/nginx.conf +++ b/configs/nginx/nginx.conf @@ -6,7 +6,7 @@ worker_processes 4; # error_log /tmp/nginx.error.log; error_log stderr; -include /etc/nginx/apps/*/main-ctx.conf; +include /usr/share/kvmd/extras/*/nginx.main-ctx.conf; events { worker_connections 1024; @@ -40,26 +40,12 @@ http { server 127.0.0.1:8082 fail_timeout=0s max_fails=0; } - include /etc/nginx/apps/*/http-ctx.conf; + include /usr/share/kvmd/extras/*/nginx.http-ctx.conf; - lua_shared_dict WS_TOKENS 10m; - init_by_lua_block { - WS_TOKEN_EXPIRES = 10; - - local cjson = require("cjson"); - local io = require("io"); - - local apps = {}; - local apps_dir_path = "/etc/nginx/apps"; - for app in io.popen("ls " .. apps_dir_path):lines() do - local manifest_file = assert(io.open(apps_dir_path .. "/" .. app .. "/manifest.json", "r")); - local manifest = cjson.decode(manifest_file:read("*all")); - manifest_file:close(); - apps[app] = manifest; - end - - APPS_JSON = cjson.encode(apps); - } +#PROD lua_shared_dict WS_TOKENS 10m; +#PROD init_by_lua_block { +#PROD WS_TOKEN_EXPIRES = 10; +#PROD } #PROD server { #PROD listen 80; @@ -98,13 +84,6 @@ http { } } - location /get_apps { - default_type "application/json"; - content_by_lua_block { - ngx.say(APPS_JSON); - } - } - location /kvmd/ws { #PROD auth_basic off; #PROD access_by_lua_block { @@ -165,6 +144,6 @@ http { proxy_ignore_headers X-Accel-Buffering; } - include /etc/nginx/apps/*/server-ctx.conf; + include /usr/share/kvmd/extras/*/nginx.server-ctx.conf; } } |