Replies: 1 comment
-
|
Nitro loads The recommended pattern:
// nitro.config.ts
export default defineNitroConfig({
runtimeConfig: {
mySecret: '', // private, server-only
public: {
apiBase: '/api', // accessible client-side too (Nuxt)
},
},
});
const config = useRuntimeConfig();
console.log(config.mySecret); // the value from envThe key is the naming convention: If you specifically need to load a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I see you using c12 and dotenv (installed but never used in code as far as I can see) but I can't get the .env file to load in config, the only way that work is to add an extends with a ts file
What ways I can load .env file into Nitro?
Beta Was this translation helpful? Give feedback.
All reactions