Merged in feat/sw-2863-move-contentstack-router-to-trpc-package (pull request #2389)
feat(SW-2863): Move contentstack router to trpc package * Add exports to packages and lint rule to prevent relative imports * Add env to trpc package * Add eslint to trpc package * Apply lint rules * Use direct imports from trpc package * Add lint-staged config to trpc * Move lang enum to common * Restructure trpc package folder structure * WIP first step * update internal imports in trpc * Fix most errors in scandic-web Just 100 left... * Move Props type out of trpc * Fix CategorizedFilters types * Move more schemas in hotel router * Fix deps * fix getNonContentstackUrls * Fix import error * Fix entry error handling * Fix generateMetadata metrics * Fix alertType enum * Fix duplicated types * lint:fix * Merge branch 'master' into feat/sw-2863-move-contentstack-router-to-trpc-package * Fix broken imports * Merge branch 'master' into feat/sw-2863-move-contentstack-router-to-trpc-package Approved-by: Linus Flood
This commit is contained in:
35
packages/trpc/env/server.ts
vendored
35
packages/trpc/env/server.ts
vendored
@@ -1,6 +1,12 @@
|
||||
import { createEnv } from "@t3-oss/env-nextjs"
|
||||
import { z } from "zod"
|
||||
|
||||
/*
|
||||
* ⚠️ Remember to also add environment variables to the corresponding config in sites that uses this package. ⚠️
|
||||
*/
|
||||
|
||||
const TWENTYFOUR_HOURS = 24 * 60 * 60
|
||||
|
||||
export const env = createEnv({
|
||||
/**
|
||||
* Due to t3-env only checking typeof window === "undefined"
|
||||
@@ -9,10 +15,39 @@ export const env = createEnv({
|
||||
*/
|
||||
isServer: typeof window === "undefined" || "Deno" in window,
|
||||
server: {
|
||||
API_BASEURL: z.string(),
|
||||
CACHE_TIME_HOTELS: z.coerce
|
||||
.number()
|
||||
.default(TWENTYFOUR_HOURS)
|
||||
.transform((val) =>
|
||||
process.env.CMS_ENVIRONMENT === "test" ? 5 * 60 : val
|
||||
),
|
||||
NODE_ENV: z.enum(["development", "test", "production"]),
|
||||
CMS_ACCESS_TOKEN: z.string(),
|
||||
CMS_BRANCH: z.enum(["development", "production"]),
|
||||
CMS_URL: z.string(),
|
||||
CMS_PREVIEW_URL: z.string(),
|
||||
CMS_PREVIEW_TOKEN: z.string(),
|
||||
SENTRY_ENVIRONMENT: z.string().default("development"),
|
||||
PUBLIC_URL: z.string().default(""),
|
||||
PRINT_QUERY: z
|
||||
.string()
|
||||
.refine((s) => s === "true" || s === "false")
|
||||
.transform((s) => s === "true")
|
||||
.default("false"),
|
||||
},
|
||||
emptyStringAsUndefined: true,
|
||||
runtimeEnv: {
|
||||
API_BASEURL: process.env.API_BASEURL,
|
||||
CACHE_TIME_HOTELS: process.env.CACHE_TIME_HOTELS,
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
CMS_ACCESS_TOKEN: process.env.CMS_ACCESS_TOKEN,
|
||||
CMS_BRANCH: process.env.CMS_BRANCH,
|
||||
CMS_URL: process.env.CMS_URL,
|
||||
CMS_PREVIEW_URL: process.env.CMS_PREVIEW_URL,
|
||||
CMS_PREVIEW_TOKEN: process.env.CMS_PREVIEW_TOKEN,
|
||||
SENTRY_ENVIRONMENT: process.env.SENTRY_ENVIRONMENT,
|
||||
PUBLIC_URL: process.env.NEXT_PUBLIC_PUBLIC_URL,
|
||||
PRINT_QUERY: process.env.PRINT_QUERY,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user