diff --git a/.env.site-configs.tpl b/.env.site-configs.tpl index 310da6218..f3438ba73 100644 --- a/.env.site-configs.tpl +++ b/.env.site-configs.tpl @@ -1,3 +1,2 @@ PRIVATE_SITE_CONFIGS='{{ site://configs/private/local }}' PUBLIC_SITE_CONFIGS='{{ site://configs/public/local }}' -NEXT_PUBLIC_SITE_CONFIGS=$PUBLIC_SITE_CONFIGS diff --git a/site/package-lock.json b/site/package-lock.json index 17128459e..5ed5d3e5f 100644 --- a/site/package-lock.json +++ b/site/package-lock.json @@ -15,7 +15,6 @@ "cache-manager": "^5.6.1", "graphql": "^15.0.0", "next": "^14.2.0", - "next-runtime-env": "^3.2.2", "react": "^18.2.0", "react-dom": "^18.2.0", "react-intl": "^6.0.0", @@ -10980,20 +10979,6 @@ } } }, - "node_modules/next-runtime-env": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/next-runtime-env/-/next-runtime-env-3.2.2.tgz", - "integrity": "sha512-S5S6NxIf3XeaVc9fLBN2L5Jzu+6dLYCXeOaPQa1RzKRYlG2BBayxXOj6A4VsciocyNkJMazW1VAibtbb1/ZjAw==", - "license": "MIT", - "dependencies": { - "next": "^14", - "react": "^18" - }, - "peerDependencies": { - "next": "^14", - "react": "^18" - } - }, "node_modules/next/node_modules/postcss": { "version": "8.4.31", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", diff --git a/site/package.json b/site/package.json index 35158bed1..b14d6c7eb 100644 --- a/site/package.json +++ b/site/package.json @@ -28,7 +28,6 @@ "cache-manager": "^5.6.1", "graphql": "^15.0.0", "next": "^14.2.0", - "next-runtime-env": "^3.2.2", "react": "^18.2.0", "react-dom": "^18.2.0", "react-intl": "^6.0.0", diff --git a/site/src/app/layout.tsx b/site/src/app/[domain]/layout.tsx similarity index 65% rename from site/src/app/layout.tsx rename to site/src/app/[domain]/layout.tsx index 798f6f244..148c6762e 100644 --- a/site/src/app/layout.tsx +++ b/site/src/app/[domain]/layout.tsx @@ -1,11 +1,11 @@ import { SitePreviewProvider } from "@comet/cms-site"; import { GlobalStyle } from "@src/layout/GlobalStyle"; -import { getSiteConfig } from "@src/middleware"; +import { getSiteConfigForDomain } from "@src/middleware"; import { ResponsiveSpacingStyle } from "@src/util/ResponsiveSpacingStyle"; +import { SiteConfigProvider } from "@src/util/SiteConfigProvider"; import StyledComponentsRegistry from "@src/util/StyledComponentsRegistry"; import type { Metadata } from "next"; import { draftMode } from "next/headers"; -import { PublicEnvScript } from "next-runtime-env"; export const metadata: Metadata = { title: "Comet Starter", @@ -13,21 +13,22 @@ export const metadata: Metadata = { export default async function RootLayout({ children, + params: { domain }, }: Readonly<{ children: React.ReactNode; + params: { domain: string }; }>) { - const { gtmId } = await getSiteConfig(); + const siteConfig = await getSiteConfigForDomain(domain); + const isDraftModeEnabled = draftMode().isEnabled; return ( - - - + - {gtmId && ( + {siteConfig.gtmId && (