#Are there any ways to define the production environment other than NODE_ENV?
9 messages · Page 1 of 1 (latest)
I don't know if that's what you meant, but I like to put nodeEnv === "development" or nodeEnv !== "development" and do the logic on top of that, because then if any letter is different from development it will run as if it were production.
Another cool technique is to use configModule, and set a security callback for some env variables like, nodeEnv: process.env.NODE_ENV ?? "production"
yes, but the point is that environment variables alone are not enough
the name of the environment variable itself is not important here
How would you define a "production environment"?
Aren't they enough? What do you mean? What are you talking about?
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
As I understand it, you are saying that there are actually no ways to programmatically determine the environment and, in essence, only the user decides what production is for him?
I mean, everyone has a different definition of production environment. The only thing you could end up doing is try to get some other unique identifier. You could use a package like systeminformation or the os module to help with the retrieval of that unique key, but you'll ultimately have to define what is considered the identifier yourself