Skip to content

Instantly share code, notes, and snippets.

View UnoYakshi's full-sized avatar
💭
虚空是什么?

Uno Yakshi UnoYakshi

💭
虚空是什么?
View GitHub Profile
@mtolk
mtolk / mermaid.html
Created September 16, 2020 12:59
This gist was created to anwser a question about using mermaidjs in the zola static site generator: https://zola.discourse.group/t/mermaid-integration/573?u=marco
<!-- should be in templates/ -->
<html>
<head>
<style>
div.mermaid {
width:25%;
}
</style>
</head>
<body>
@runlevel5
runlevel5 / nginx_njs_environment_variables.md
Last active July 16, 2025 00:08
Using njs to fetch environment variables

There are many ways to parse in variable into the nginx config file. Some uses set_by_lua which is offered by lua-nginx-module. Some use envstubst to populate varilabes into a template file.

Today I am going to show you how to do that with njs the JS scripting engine for nginx.

## /etc/nginx/fetch_env.js
function fetch_upstream_host(r) {
 return process.env.UPSTREAM_HOST;