Skip to content

Commit 3db73ff

Browse files
authored
fix(whitelabel): make terms and privacy URL envvars available at build time (#1222)
1 parent 9ffb48e commit 3db73ff

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

apps/sim/next.config.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { withSentryConfig } from '@sentry/nextjs'
22
import type { NextConfig } from 'next'
3-
import { env, isTruthy } from './lib/env'
3+
import { env, getEnv, isTruthy } from './lib/env'
44
import { isDev, isHosted, isProd } from './lib/environment'
55
import { getMainCSPPolicy, getWorkflowExecutionCSPPolicy } from './lib/security/csp'
66

@@ -187,18 +187,20 @@ const nextConfig: NextConfig = {
187187
async redirects() {
188188
const redirects = []
189189
// Add whitelabel redirects for terms and privacy pages if external URLs are configured
190-
if (env.NEXT_PUBLIC_TERMS_URL?.startsWith('http')) {
190+
const termsUrl = getEnv('NEXT_PUBLIC_TERMS_URL')
191+
if (termsUrl?.startsWith('http')) {
191192
redirects.push({
192193
source: '/terms',
193-
destination: env.NEXT_PUBLIC_TERMS_URL,
194+
destination: termsUrl,
194195
permanent: false,
195196
})
196197
}
197198

198-
if (env.NEXT_PUBLIC_PRIVACY_URL?.startsWith('http')) {
199+
const privacyUrl = getEnv('NEXT_PUBLIC_PRIVACY_URL')
200+
if (privacyUrl?.startsWith('http')) {
199201
redirects.push({
200202
source: '/privacy',
201-
destination: env.NEXT_PUBLIC_PRIVACY_URL,
203+
destination: privacyUrl,
202204
permanent: false,
203205
})
204206
}

0 commit comments

Comments
 (0)