#Are there any ways to define the production environment other than NODE_ENV?

9 messages · Page 1 of 1 (latest)

mighty dew
#

I need to determine from the service that the current execution environment is production. I cannot rely only on NODE_ENV (environment variables in a broad sense). Are there any more or less reliable ways to do this?

golden creek
#

Another cool technique is to use configModule, and set a security callback for some env variables like, nodeEnv: process.env.NODE_ENV ?? "production"

mighty dew
#

yes, but the point is that environment variables alone are not enough
the name of the environment variable itself is not important here

rocky quarry
#

How would you define a "production environment"?

golden creek
#

Aren't they enough? What do you mean? What are you talking about?

mighty dew
#

All right.
Let's say I have a module that runs under a license
One license key - one nestjs project, no more.
At the same time, if the local (non-production) project uses the same license key, everything is ok

mighty dew
rocky quarry