82 lines
2.4 KiB
TypeScript
Executable File
82 lines
2.4 KiB
TypeScript
Executable File
import { writeFileSync } from "fs"
|
|
|
|
const mappings = {
|
|
// portfolio
|
|
"silicoflare.dev": "http://sunfire:3000",
|
|
"www.silicoflare.dev": "http://sunfire:3000",
|
|
"www.hy-pr.link": "http://sunfire:3000",
|
|
"blog.silicoflare.dev": "http://sunfire:2368",
|
|
|
|
// mini-services
|
|
"yamtrack.hy-pr.link": "http://sunfire:9002",
|
|
"todo.hy-pr.link": "http://sunfire:9001",
|
|
"affine.hy-pr.link": "http://sunfire:9005",
|
|
"affine-nyx.hy-pr.link": "http://sunfire:9005",
|
|
"cash.hy-pr.link": "http://sunfire:9006",
|
|
"pin.hy-pr.link": "http://sunfire:9007",
|
|
// "stardew.hy-pr.link": "http://sunfire:9008",
|
|
// "keep.hy-pr.link": "http://sunfire:9010",
|
|
"dl-api.hy-pr.link": "http://sunfire:9011",
|
|
"dl.hy-pr.link": "http://sunfire:9012",
|
|
"pics.hy-pr.link": "http://sunfire:9013",
|
|
"books.hy-pr.link": "http://sunfire:9014",
|
|
"nametag.hy-pr.link": "http://sunfire:9015",
|
|
"rss.hy-pr.link": "http://sunfire:8080",
|
|
|
|
// mega-services
|
|
"git.hy-pr.link": "http://sunfire:9100",
|
|
"ntfy.hy-pr.link": "http://localhost:9101",
|
|
"chat.hy-pr.link": "http://sunfire:9102",
|
|
"dav.hy-pr.link": "http://sunfire:9103",
|
|
"files.hy-pr.link": "http://sunfire:9104",
|
|
"ytrewq.hy-pr.link": "http://sunfire:9105",
|
|
"pocketbase.hy-pr.link": "http://sunfire:8090",
|
|
"immich.hy-pr.link": "http://sunfire:2283",
|
|
"auth.hy-pr.link": "http://sunfire:1411",
|
|
|
|
// other
|
|
"webhook.hy-pr.link": "http://sunfire:8000",
|
|
"docs.hy-pr.link": "http://sunfire:10000",
|
|
"license.hy-pr.link": "http://sunfire:10001",
|
|
"type.hy-pr.link": "http://ultramarine:3000",
|
|
"type-api.hy-pr.link": "http://ultramarine:5005",
|
|
|
|
// statics
|
|
"chef.hy-pr.link": "http://100.64.0.3:8100",
|
|
"it-tools.hy-pr.link": "http://100.64.0.3:8101",
|
|
"vert.hy-pr.link": "http://100.64.0.3:8103",
|
|
"pdf.hy-pr.link": "http://100.64.0.3:8104",
|
|
}
|
|
|
|
let caddyfile = `# Caddyfile
|
|
http://139.84.140.254 {
|
|
redir https://silicoflare.dev{uri}
|
|
}
|
|
|
|
hy-pr.link {
|
|
redir /silicoflare https://silicoflare.dev
|
|
redir /flare https://silicoflare.dev
|
|
}
|
|
|
|
ssh.hy-pr.link {
|
|
header Content-Type text/plain
|
|
respond "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINt3OrGyuZkH+NliwamlZJPFJsgSF4O2+V149EUhtq3l silicoflare.dev\n" 200
|
|
}
|
|
|
|
ssh.silicoflare.dev {
|
|
header Content-Type text/plain
|
|
respond "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINt3OrGyuZkH+NliwamlZJPFJsgSF4O2+V149EUhtq3l silicoflare.dev\n" 200
|
|
}
|
|
|
|
`
|
|
|
|
Object.entries(mappings).map(([key, value]) => {
|
|
caddyfile += `${key} {
|
|
reverse_proxy ${value}
|
|
}
|
|
|
|
`
|
|
})
|
|
|
|
writeFileSync("/etc/caddy/Caddyfile", caddyfile)
|