MENU

Fun & Interesting

Masterclass | Node.js Configurations

Platformatic 5,982 1 year ago
Video Not Working? Fix It Now

In the beginning, there were configuration files. Every environment had one committed to a repository. Then, we discovered the beauty of 12-factor applications and of having environment-specific values set as environment variables.Then, NODE_ENV came along, and shattered our idyllic world. Libraries with millions of weekly downloads check for NODE_ENV=production to enable optimizations, changing the behaviour of applications. Given this worked so well, developers started loading configuration files (or secrets) based on the value of NODE_ENV to identify _their_ "production" environment. However, questions began to arise. What value should be used for the staging environment? What about QA? Ultimately, if the same code isn’t run everywhere, we face being hit by bugs that cannot be reproduced across environments, which leads us to set NODE_ENV=production everywhere. In this masterclass, we explored: •Why managing configurations is important; •How to distinguish between environments; •What risks NODE_ENV can pose; •Node.js configuration best practices; •How to set up Node.js configurations with Platformatic

Comment