no dns in dev mode

This commit is contained in:
Chris Wanstrath 2025-09-28 14:18:00 -07:00
parent b44c4d10fb
commit 88640d7acf

View File

@ -16,6 +16,7 @@ const host = hostRaw.toString().trim()
let dnsInit = false
export async function initDNS() {
if (process.env.NODE_ENV !== "production") return
dnsInit = true
apps().forEach(publishAppDNS)
@ -31,8 +32,8 @@ export async function initDNS() {
}
export function publishAppDNS(app: string) {
if (!dnsInit) throw "publishAppDNS() must be called after initDNS()"
if (process.env.NODE_ENV !== "production") return
if (!dnsInit) throw "publishAppDNS() must be called after initDNS()"
if (!dnsEntries[app])
dnsEntries[app] = Bun.spawn(["avahi-publish", "-a", `${app}.${host}.local`, "-R", ip])