Software Devs, what’s your take on Applications using their running environment for configuration?

One of the devs I work with said he considered checking the environment (e.g. process.env.NODE_ENV == production), and configuring the application based on the running environment 'a code smell.' He suggested we break this out into an environment variable, instead.

For this particular example, we wanted logging to act differently in dev & test (human readable output) vs production (json output). This resulted in a statement similar to the following:

let logFormat if (process.env.NODE_ENV == 'production') { logFormat = winston.format.json() } else { logFormat = winston.format.simple() } 

What's your take on this? Are there any well-written articles supporting this practice, or advising against this technique?

submitted by /u/beast_master
[link] [comments]

from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! http://bit.ly/2ESSu5u

Leave a comment

Design a site like this with WordPress.com
Get started
search previous next tag category expand menu location phone mail time cart zoom edit close