Comments (1)
Could you solve this with some plain old javascript or will the proxy break if you do something like:
const $env = createEnv({
isServer: typeof window === "undefined",
emptyStringAsUndefined: true,
/*
* Serverside Environment variables, not available on the client.
* Will throw if you access these variables on the client.
*/
server: {
BACKEND_CONNECTION_PROTOCOL: z.enum(["http", "https"]).default("http"),
BACKEND_ADDRESS: z.string().url().min(1).or(z.string().ip()),
BACKEND_PORT: z.coerce.number().optional(),
BACKEND_API_PREFIX: z.string().min(1).optional(),
},
runtimeEnv: {
BACKEND_CONNECTION_PROTOCOL: process.env.BACKEND_CONNECTION_PROTOCOL,
BACKEND_ADDRESS: process.env.BACKEND_ADDRESS,
BACKEND_PORT: process.env.BACKEND_PORT,
BACKEND_API_PREFIX: process.env.BACKEND_API_PREFIX,
},
});
export const env = Object.assign($env, {
NEXT_BACKEND_ABSOLUTE_URL: `${$env.BACKEND_CONNECTION_PROTOCOL}://${$env.BACKEND_ADDRESS}:${$env.BACKEND_PORT}${$env.BACKEND_API_PREFIX}`
})
from t3-env.
Related Issues (20)
- Is there a way not to include zod into the bundle? HOT 1
- Using shared variables with no clientPrefix HOT 1
- Validation lib agnostic
- Support for key nesting HOT 1
- Support Custom Prefixes for Client Environment Variables in `@t3-oss/env-nextjs` HOT 1
- Feature request - add support for express js HOT 1
- `@ts-oss/[email protected]` Release Failure
- Shared variables from an extended config throw when used on the client
- How can I use a common variable and a client variable without a prefix? Nuxt 3 HOT 1
- Problems with package import in version 0.9.1, How can I make Jest work successfully? HOT 3
- Proposal to add extensions.json HOT 1
- Issue with Loading Environment Variables in Docker Container HOT 5
- Cannot find module '@t3-oss/env-core' or its corresponding type declarations. HOT 2
- Bundling Next.JS app results in environment key names exposed in the bundled js chunks HOT 2
- conditional environment variable based on environment HOT 4
- Vercel Server environment variables being populated HOT 2
- t2-env package dependencies vs devDependencies HOT 1
- SvelteKit + @sveltejs/adapter-node = "Attempted to access a server-side environment variable on the client"
- Error Missing "./dist" specifier in "@t3-oss/env-core" package
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from t3-env.