.. | ||
site | ||
Dockerfile | ||
README.md |
print env via NJS
Dockerfile:
FROM docker.io/rockdrilla/angie-conv:v0.0.6
COPY /site/ /etc/angie/site/
## install 'angie-module-njs' and process package contents
RUN apt-install-angie-mod.sh njs ; \
apt-clean.sh
## load ngx_http_js_module
ENV NGX_HTTP_MODULES='njs'
configuration:
server {
listen 8080;
location / { return 204; }
js_import ngx_env.js;
location = /env
{
js_content ngx_env.report;
}
}
NJS script:
function report(r) {
var s = "";
const keys = Object.keys(process.env).sort();
for (const i in keys) {
const k = keys[i];
const v = process.env[k];
s += k + '=' + v + "\n";
}
r.return(200, s);
}
export default { report };
Test URI e.g. with curl
:
curl http://127.0.0.1:8080/env