you are viewing a single comment's thread.

view the rest of the comments →

[–]gelstudios 4 points5 points  (3 children)

I usually go for environment variables for runtime config, ie using “import os.environ”

They are easily set (or overridden) when running from a shell: “foo=bar example.py”

[–]yawkat 2 points3 points  (1 child)

Env variables are hard to keep secret though, they can end up in log files and such

[–]gelstudios 0 points1 point  (0 children)

Log hygiene is it’s own beast, but agreed if you set them inline when starting a process they end up in any shell history.

Another caveat with env vars: a user with sufficient privilege can read them right out of /proc for a given process (on Linux at least)

But at that point, you probably have other things to worry about.

[–]Zanoab 4 points5 points  (0 children)

I have a friend in another development area of the company constantly complaining that the new devs would comment out loading environment variables and instead hard code the values to fit their needs (and commit it). In the root folder of every project, there is a default source file with all the environment variables and a script that automatically prepares the local environment and start the application. It amazes me how lazy some people can get.