Merged in chore/cleanup-after-trpc-migration (pull request #2457)
Chore/cleanup after trpc migration * Clean up TODOs * Rename REDEMPTION constant to SEARCH_TYPE_REDEMPTION * Update dependencies Remove unused deps from scandic-web Add missing deps to trpc package * Update self-referencing imports * Remove unused variables from scandic-web env * Fix missing graphql-tag package * Actually fix * Remove unused env var Approved-by: Christian Andolf Approved-by: Linus Flood
This commit is contained in:
27
packages/trpc/env/server.ts
vendored
27
packages/trpc/env/server.ts
vendored
@@ -1,17 +1,9 @@
|
||||
import { createEnv } from "@t3-oss/env-nextjs"
|
||||
import { z } from "zod"
|
||||
|
||||
import { isLangLive } from "../lib/DUPLICATED/isLangLive"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
/*
|
||||
* ⚠️ Remember to also add environment variables to the corresponding config in sites that uses this package. ⚠️
|
||||
*/
|
||||
|
||||
const TWENTYFOUR_HOURS = 24 * 60 * 60
|
||||
|
||||
const _env = createEnv({
|
||||
export const env = createEnv({
|
||||
/**
|
||||
* Due to t3-env only checking typeof window === "undefined"
|
||||
* and Netlify running Deno, window is never "undefined"
|
||||
@@ -48,17 +40,6 @@ const _env = createEnv({
|
||||
.refine((s) => s === "true" || s === "false")
|
||||
.transform((s) => s === "true")
|
||||
.default("false"),
|
||||
/**
|
||||
* Include the languages that should be hidden for the next release
|
||||
* Should be in the format of "en,da,de,fi,no,sv" or empty
|
||||
*/
|
||||
NEW_SITE_LIVE_FOR_LANGS: z
|
||||
.string()
|
||||
.regex(/^([a-z]{2},)*([a-z]{2}){0,1}$/)
|
||||
.transform((val) => {
|
||||
return val.split(",")
|
||||
})
|
||||
.default(""),
|
||||
SALESFORCE_PREFERENCE_BASE_URL: z.string(),
|
||||
},
|
||||
emptyStringAsUndefined: true,
|
||||
@@ -80,12 +61,6 @@ const _env = createEnv({
|
||||
SENTRY_ENVIRONMENT: process.env.SENTRY_ENVIRONMENT,
|
||||
PUBLIC_URL: process.env.NEXT_PUBLIC_PUBLIC_URL,
|
||||
PRINT_QUERY: process.env.PRINT_QUERY,
|
||||
NEW_SITE_LIVE_FOR_LANGS: process.env.NEXT_PUBLIC_NEW_SITE_LIVE_FOR_LANGS,
|
||||
SALESFORCE_PREFERENCE_BASE_URL: process.env.SALESFORCE_PREFERENCE_BASE_URL,
|
||||
},
|
||||
})
|
||||
|
||||
export const env = {
|
||||
..._env,
|
||||
isLangLive: (lang: Lang) => isLangLive(lang, _env.NEW_SITE_LIVE_FOR_LANGS),
|
||||
} as const
|
||||
|
||||
Reference in New Issue
Block a user