IC, Caddyfile

This commit is contained in:
2026-07-15 04:29:40 +02:00
commit edf3ce27f2
11 changed files with 244 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
import type { Service } from "./types";
/**
assembles the contents for caddyfile
**/
export function formatcaddyfile(proxies: Service[]): string {
let output = "# generated by typescript\n\n";
const proxyconfig = proxies.map(proxy => {
const fullDomain = `${proxy.subdomain}.${proxy.host.baseDomain}`;
const destination = `${proxy.host.ip}:${proxy.port}`
return `${fullDomain} {
reverse_proxy ${destination}
}`
}).join('\n');
return output + proxyconfig
}