Home > Software engineering >  Is there an alternative way to use environmental variables in NextJS
Is there an alternative way to use environmental variables in NextJS

Time:04-03

I have developed a website using NextJS which uses many environment variables. Recently I bought a website hosting service called Winhost. After signup only I realized that it doesn't support environment variables but that is really essential for me.

So is there an alternative way I can use environment variables in production in NextJS like accessing it from the cloud?

CodePudding user response:

I imagine you can find a workaround, but I wouldn't rely on an hosting that doesn't support such a basic feature. You could save those variables in a cloud based db, like firestore, and retrieve them in a middleware before using them in your API controllers. But if you need some of them during server setup I think you are going to have some problems...

CodePudding user response:

you can use environment variables like this in your next.js application https://nextjs.org/docs/basic-features/environment-variables

  • Related