IC, Caddyfile
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user