summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configs/nginx/ext.d/noop/http-ctx.conf0
-rw-r--r--configs/nginx/ext.d/noop/main-ctx.conf0
-rw-r--r--configs/nginx/ext.d/noop/server-ctx.conf0
-rw-r--r--configs/nginx/nginx.conf30
-rw-r--r--testenv/Dockerfile1
5 files changed, 26 insertions, 5 deletions
diff --git a/configs/nginx/ext.d/noop/http-ctx.conf b/configs/nginx/ext.d/noop/http-ctx.conf
deleted file mode 100644
index e69de29b..00000000
--- a/configs/nginx/ext.d/noop/http-ctx.conf
+++ /dev/null
diff --git a/configs/nginx/ext.d/noop/main-ctx.conf b/configs/nginx/ext.d/noop/main-ctx.conf
deleted file mode 100644
index e69de29b..00000000
--- a/configs/nginx/ext.d/noop/main-ctx.conf
+++ /dev/null
diff --git a/configs/nginx/ext.d/noop/server-ctx.conf b/configs/nginx/ext.d/noop/server-ctx.conf
deleted file mode 100644
index e69de29b..00000000
--- a/configs/nginx/ext.d/noop/server-ctx.conf
+++ /dev/null
diff --git a/configs/nginx/nginx.conf b/configs/nginx/nginx.conf
index ecc93b79..644f9694 100644
--- a/configs/nginx/nginx.conf
+++ b/configs/nginx/nginx.conf
@@ -42,17 +42,29 @@ http {
include /etc/nginx/ext.d/*/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");
+
+ EXTENSIONS = {};
+ local extensions_dir_path = "/etc/nginx/ext.d";
+ for extension in io.popen("ls " .. extensions_dir_path):lines() do
+ local manifest_file = assert(io.open(extensions_dir_path .. "/" .. extension .. "/manifest.json", "r"));
+ local manifest = cjson.decode(manifest_file:read("*all"));
+ manifest_file:close();
+ EXTENSIONS[manifest["name"]] = manifest;
+ end
+ }
+
#PROD server {
#PROD listen 80;
#PROD server_name localhost;
#PROD return 301 https://$host$request_uri;
#PROD }
-#PROD lua_shared_dict WS_TOKENS 10m;
-#PROD init_by_lua_block {
-#PROD WS_TOKEN_EXPIRES = 10;
-#PROD }
-
server {
#PROD listen 443 ssl http2;
server_name localhost;
@@ -84,6 +96,14 @@ http {
}
}
+ location /extensions {
+ default_type "application/json";
+ content_by_lua_block {
+ local cjson = require("cjson");
+ ngx.say(cjson.encode(EXTENSIONS));
+ }
+ }
+
location /kvmd/ws {
#PROD auth_basic off;
#PROD access_by_lua_block {
diff --git a/testenv/Dockerfile b/testenv/Dockerfile
index ce00df0a..90573038 100644
--- a/testenv/Dockerfile
+++ b/testenv/Dockerfile
@@ -40,6 +40,7 @@ RUN pacman -Syy \
nginx-mainline \
ustreamer \
socat \
+ lua51-cjson \
&& env MAKEPKGOPTS="--skipchecksums --skippgpcheck" user-packer -S --noconfirm nginx-mainline-mod-lua \
&& pacman -Sc --noconfirm