Route Coolify through a scanned Comfy proxy instead of pinning hopped listen ports.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { AsyncLocalStorage } from 'node:async_hooks'
|
||||
import { getComfyHost } from '~/server/utils/comfy'
|
||||
import { getComfyHost, viaAgentFrontDoor } from '~/server/utils/comfy'
|
||||
import { comfyJobPrefix } from '~/utils/outputNames'
|
||||
|
||||
const imageHostAls = new AsyncLocalStorage<string>()
|
||||
@@ -31,7 +31,7 @@ function normalizeHost(raw: string, port = '') {
|
||||
export function getBeastImageHost() {
|
||||
const config = useRuntimeConfig()
|
||||
const explicit = String(config.imageComfyPrimaryHost || process.env.IMAGE_COMFY_PRIMARY_HOST || '').trim()
|
||||
if (explicit) return normalizeHost(explicit)
|
||||
if (explicit) return viaAgentFrontDoor(normalizeHost(explicit))
|
||||
try {
|
||||
return getComfyHost()
|
||||
} catch {
|
||||
@@ -53,7 +53,7 @@ export function getSidecarImageHost() {
|
||||
]
|
||||
for (const [raw, extraPort] of candidates) {
|
||||
if (!raw || isRetiredSidecarHost(raw)) continue
|
||||
const host = normalizeHost(raw, extraPort)
|
||||
const host = viaAgentFrontDoor(normalizeHost(raw, extraPort))
|
||||
if (host && !isRetiredSidecarHost(host)) return host
|
||||
}
|
||||
return getBeastImageHost()
|
||||
@@ -61,8 +61,8 @@ export function getSidecarImageHost() {
|
||||
|
||||
export function getImageComfyHost() {
|
||||
const fromAls = imageHostAls.getStore()
|
||||
if (fromAls) return fromAls
|
||||
if (imageComfyHostOverride) return imageComfyHostOverride
|
||||
if (fromAls) return viaAgentFrontDoor(fromAls) || fromAls
|
||||
if (imageComfyHostOverride) return viaAgentFrontDoor(imageComfyHostOverride) || imageComfyHostOverride
|
||||
return getBeastImageHost() || getSidecarImageHost()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user