franciscop / server

:desktop_computer: Simple and powerful server for Node.js
https://serverjs.io/
MIT License
3.56k stars 171 forks source link

Using custom types for NODE_ENV #112

Closed justinpage closed 5 years ago

justinpage commented 5 years ago

What are you trying to do? We would like to use custom names for NODE_ENV.

Instead of forcing us to choose the following:

We would like to use our company's naming convention:

Ask your question Is there a way to use our own naming convention when defining NODE_ENV? According to the documentation, it can only be the first three I mentioned above. What is the motivation behind limiting this and have you ever entertained the thought of an override feature?

Thanks!

franciscop commented 5 years ago

The names server.js is using are common in many different projects and environments across Node.js:

If you use your own naming conventions some 3rd party tools might not work as expected. It's also easy to type testing instead of test for instance, and unless it's limited to enum that mistake could have severe consequences. That's the motivation behind limiting this and why it won't change.

Note: you can probably "hack" this option at runtime, but if you go down that route make sure to pin the version down since that wouldn't be covered by SemVer.