Developers don't have to load production env vars and execute nuxt build. Env vars can be directly read from production.
Right now, when i console.log(process.env) from my production (AWS Elastic Beanstalk), the env returned are all my dev environment.
I had to run nuxt build then upload the entire project to AWS EB.
Good idea, i use build(pm2) in the beta environment, but env === production.
i need to set env using pm2
you could use https://github.com/samtgarson/nuxt-env
@aldarund Thanks, but this is not what I need
@gotoin I'm.not sure what u need, but that module do exactly what was asked in initial issue
@gotoin Completely agree with @aldarund, as I am using nuxt-env to achieve exactly this (hosting on Azure, App Settings variables differ for different slots and map to env vars at runtime, builds done on the dev machine and deployed directly to one of the slots). Swapping the slots immediately (of course, there is an app restart in the background as part of slot warm-up) changes what the app sees.
You just has to be careful which variables you allow to be exposed through this module, as they will be available on the client-side as well in that case. So, this module is unusable for anything what is really a secret. Having said that, there is no problem in using the same principle this module uses to expose an env var server-side only.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
you could use https://github.com/samtgarson/nuxt-env