I think we might finally have the env crap figured out

This commit is contained in:
2026-03-21 17:20:57 -05:00
parent 1e61e34fb8
commit 5e37d10300
6 changed files with 15 additions and 12 deletions

View File

@@ -1,7 +1,10 @@
import { env } from './src/env.js'; import { createJiti } from 'jiti';
import { withSentryConfig } from '@sentry/nextjs'; import { withSentryConfig } from '@sentry/nextjs';
import { withPlausibleProxy } from 'next-plausible'; import { withPlausibleProxy } from 'next-plausible';
const jiti = createJiti(import.meta.url);
await jiti.import('./src/env');
/** @type {import("next").NextConfig} */ /** @type {import("next").NextConfig} */
const config = withPlausibleProxy({ const config = withPlausibleProxy({
customDomain: process.env.NEXT_PUBLIC_PLAUSIBLE_URL, customDomain: process.env.NEXT_PUBLIC_PLAUSIBLE_URL,
@@ -29,12 +32,12 @@ const config = withPlausibleProxy({
const sentryConfig = { const sentryConfig = {
// For all available options, see: // For all available options, see:
// https://www.npmjs.com/package/@sentry/webpack-plugin#options // https://www.npmjs.com/package/@sentry/webpack-plugin#options
org: env.NEXT_PUBLIC_SENTRY_ORG, org: process.env.NEXT_PUBLIC_SENTRY_ORG,
project: env.NEXT_PUBLIC_SENTRY_PROJECT_NAME, project: process.env.NEXT_PUBLIC_SENTRY_PROJECT_NAME,
sentryUrl: env.NEXT_PUBLIC_SENTRY_URL, sentryUrl: process.env.NEXT_PUBLIC_SENTRY_URL,
authToken: env.SENTRY_AUTH_TOKEN, authToken: process.env.SENTRY_AUTH_TOKEN,
// Only print logs for uploading source maps in CI // Only print logs for uploading source maps in CI
silent: !env.CI, silent: !process.env.CI,
// For all available options, see: // For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/ // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Upload a larger set of source maps for prettier stack traces (increases build time) // Upload a larger set of source maps for prettier stack traces (increases build time)

View File

@@ -15,7 +15,7 @@ import * as Sentry from '@sentry/nextjs';
import PlausibleProvider from 'next-plausible'; import PlausibleProvider from 'next-plausible';
import { Button, ThemeProvider, Toaster } from '@gib/ui'; import { Button, ThemeProvider, Toaster } from '@gib/ui';
import { env } from '@/env.js'; import { env } from '@/env';
export const metadata: Metadata = generateMetadata(); export const metadata: Metadata = generateMetadata();
@@ -46,7 +46,7 @@ const GlobalError = ({ error, reset = undefined }: GlobalErrorProps) => {
}, [error]); }, [error]);
return ( return (
<PlausibleProvider <PlausibleProvider
domain={env.NEXT_PUBLIC_SITE_URL} domain={env.NEXT_PUBLIC_SITE_URL.trim().replace(/^https?:\/\//, '')}
customDomain={env.NEXT_PUBLIC_PLAUSIBLE_URL} customDomain={env.NEXT_PUBLIC_PLAUSIBLE_URL}
> >
<html lang='en' suppressHydrationWarning> <html lang='en' suppressHydrationWarning>

View File

@@ -1,6 +1,6 @@
import type { Metadata, Viewport } from 'next'; import type { Metadata, Viewport } from 'next';
import { Geist, Geist_Mono } from 'next/font/google'; import { Geist, Geist_Mono } from 'next/font/google';
import { env } from '@/env.js'; import { env } from '@/env';
import '@/app/styles.css'; import '@/app/styles.css';
@@ -39,7 +39,7 @@ const RootLayout = ({
return ( return (
<ConvexAuthNextjsServerProvider> <ConvexAuthNextjsServerProvider>
<PlausibleProvider <PlausibleProvider
domain={env.NEXT_PUBLIC_SITE_URL} domain={env.NEXT_PUBLIC_SITE_URL.trim().replace(/^https?:\/\//, '')}
customDomain={env.NEXT_PUBLIC_PLAUSIBLE_URL} customDomain={env.NEXT_PUBLIC_PLAUSIBLE_URL}
> >
<html lang='en' suppressHydrationWarning> <html lang='en' suppressHydrationWarning>

View File

@@ -1,6 +1,6 @@
// https://docs.sentry.io/platforms/javascript/guides/nextjs/ // https://docs.sentry.io/platforms/javascript/guides/nextjs/
import * as Sentry from '@sentry/nextjs'; import * as Sentry from '@sentry/nextjs';
import { env } from '@/env.js'; import { env } from '@/env';
Sentry.init({ Sentry.init({
dsn: env.NEXT_PUBLIC_SENTRY_DSN, dsn: env.NEXT_PUBLIC_SENTRY_DSN,

View File

@@ -1,5 +1,5 @@
import * as Sentry from '@sentry/nextjs'; import * as Sentry from '@sentry/nextjs';
import { env } from '@/env.js'; import { env } from '@/env';
Sentry.init({ Sentry.init({
dsn: env.NEXT_PUBLIC_SENTRY_DSN, dsn: env.NEXT_PUBLIC_SENTRY_DSN,