mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(whitelabel): make terms and privacy URL envvars available at build time (#1222)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { withSentryConfig } from '@sentry/nextjs'
|
||||
import type { NextConfig } from 'next'
|
||||
import { env, isTruthy } from './lib/env'
|
||||
import { env, getEnv, isTruthy } from './lib/env'
|
||||
import { isDev, isHosted, isProd } from './lib/environment'
|
||||
import { getMainCSPPolicy, getWorkflowExecutionCSPPolicy } from './lib/security/csp'
|
||||
|
||||
@@ -187,18 +187,20 @@ const nextConfig: NextConfig = {
|
||||
async redirects() {
|
||||
const redirects = []
|
||||
// Add whitelabel redirects for terms and privacy pages if external URLs are configured
|
||||
if (env.NEXT_PUBLIC_TERMS_URL?.startsWith('http')) {
|
||||
const termsUrl = getEnv('NEXT_PUBLIC_TERMS_URL')
|
||||
if (termsUrl?.startsWith('http')) {
|
||||
redirects.push({
|
||||
source: '/terms',
|
||||
destination: env.NEXT_PUBLIC_TERMS_URL,
|
||||
destination: termsUrl,
|
||||
permanent: false,
|
||||
})
|
||||
}
|
||||
|
||||
if (env.NEXT_PUBLIC_PRIVACY_URL?.startsWith('http')) {
|
||||
const privacyUrl = getEnv('NEXT_PUBLIC_PRIVACY_URL')
|
||||
if (privacyUrl?.startsWith('http')) {
|
||||
redirects.push({
|
||||
source: '/privacy',
|
||||
destination: env.NEXT_PUBLIC_PRIVACY_URL,
|
||||
destination: privacyUrl,
|
||||
permanent: false,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user