diff --git a/server/lib/config.ts b/server/lib/config.ts index b8e61617..7c5ad227 100644 --- a/server/lib/config.ts +++ b/server/lib/config.ts @@ -274,6 +274,7 @@ export class Config { ?.allow_base_domain_resources ? "true" : "false"; + process.env.DASHBOARD_URL = parsedConfig.data.app.dashboard_url; this.rawConfig = parsedConfig.data; } diff --git a/src/app/[orgId]/settings/sites/CreateSiteForm.tsx b/src/app/[orgId]/settings/sites/CreateSiteForm.tsx index 849c376f..72774fdd 100644 --- a/src/app/[orgId]/settings/sites/CreateSiteForm.tsx +++ b/src/app/[orgId]/settings/sites/CreateSiteForm.tsx @@ -75,6 +75,7 @@ export default function CreateSiteForm({ const { toast } = useToast(); const api = createApiClient(useEnvContext()); + const { env } = useEnvContext(); const [isLoading, setIsLoading] = useState(false); const [isChecked, setIsChecked] = useState(false); @@ -234,13 +235,7 @@ Endpoint = ${siteDefaults.endpoint}:${siteDefaults.listenPort} PersistentKeepalive = 5` : ""; - // am I at http or https? - let proto = "https:"; - // if (typeof window !== "undefined") { - // proto = window.location.protocol; - // } - - const newtConfig = `newt --id ${siteDefaults?.newtId} --secret ${siteDefaults?.newtSecret} --endpoint ${proto}//${siteDefaults?.endpoint}`; + const newtConfig = `newt --id ${siteDefaults?.newtId} --secret ${siteDefaults?.newtSecret} --endpoint ${env.app.dashboardUrl}`; return (