#!/usr/bin/env -S deno run import ngx from "jsr:@char/ngx@0.2"; const DOMAIN = "plc.cerulea.blue"; export const config = ngx("server", [ ngx.serverName(DOMAIN), ngx.listen(), ngx.letsEncrypt(DOMAIN), "add_header Access-Control-Allow-Origin '*' always", "add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS' always", "add_header Access-Control-Allow-Headers '*' always", ngx("location /", [ ngx("if ($request_method = OPTIONS)", ["return 204"]), "proxy_pass http://127.0.0.1:2486", "proxy_http_version 1.1", "proxy_set_header Host $host", "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for", "proxy_set_header X-Forwarded-Proto $scheme", "proxy_set_header Connection ''", ]), ]); export const path = "plc.conf"; if (import.meta.main) console.log(config.build());