Make ngx script only write the config if run directly

main
Charlotte Som 2023-11-16 04:37:00 +00:00
parent 316d7b52d8
commit 67c65c4f1b
1 changed files with 6 additions and 2 deletions

View File

@ -2,11 +2,15 @@
import ngx from "https://char.lt/ngx/ngx.ts?v=1";
ngx("server", [
export const site = ngx("server", [
[
"server_name bio.char.lt",
...ngx.listen(),
...ngx.letsEncrypt("bio.char.lt"),
],
ngx("location /", ["root /srv/http/bio.char.lt/public"]),
]).write("/etc/nginx/http.d/bio-char-lt.conf");
]);
if (import.meta.main) {
site.write("/etc/nginx/http.d/bio-char-lt.conf");
}