Inside my nextjs project I have variables added in both .env and next.conf.js files. Inside next.conf.js file it looks like this
module.exports = {
env: {
NEXT_PUBLIC_JWT_SECRET: "...",
},
publicRuntimeConfig: {
NEXT_PUBLIC_JWT_SECRET: "...",
API_JWT_SECRET: process.env.API_JWT_SECRET,
},
serverRuntimeConfig: {
// Will only be available on the server side
NEXT_PUBLIC_JWT_SECRET: "...",
secondSecret: process.env.JWT_SECRET, // Pass through env variables
},
};
I have tried all this ways to get the secret ket in my _middleware file, but none of them worked. From this github issue I assume that there is a way to do that. So could you please show me the correct way to get secret ket inside _middleware?