diff --git a/apps/api/src/cli/commands/services.ts b/apps/api/src/cli/commands/services.ts index f8c220d00e..36276b1f2b 100644 --- a/apps/api/src/cli/commands/services.ts +++ b/apps/api/src/cli/commands/services.ts @@ -4,19 +4,7 @@ * Replaces scripts/dev-services-cli.ts with a proper CLI subcommand. * Plain console output — no Ink UI needed for these one-shot commands. */ -function externalUrlOrNull(url: string | undefined): string | null { - if (!url) return null; - try { - const parsed = new URL(url); - const host = parsed.hostname; - if (host === "localhost" || host === "127.0.0.1" || host === "::1") { - return null; - } - return url; - } catch { - return null; - } -} +import { externalUrlOrNull } from "../../settings/resolve-config"; export interface ServicesOptions { subcommand: string; diff --git a/apps/api/src/settings/resolve-config.ts b/apps/api/src/settings/resolve-config.ts index c5be7e16b5..70c38851dd 100644 --- a/apps/api/src/settings/resolve-config.ts +++ b/apps/api/src/settings/resolve-config.ts @@ -119,7 +119,7 @@ function toBoolWithDefault( * Determine if a URL points to a non-local host (i.e., an external service). * Returns the URL string if external, null if local or not set. */ -function externalUrlOrNull(url: string | undefined): string | null { +export function externalUrlOrNull(url: string | undefined): string | null { if (!url) return null; try { const parsed = new URL(url);