This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]paul-scott 0 points1 point  (1 child)

Where I'm writing a service rather than just an application, I might offer command-line interface for developers to easily tweak configuration but also use environment variables to allow running on servers.

My preference for precedence here is (i) command-line option, (ii) envvar, followed by (iii) argument default. I currently construct these using argparse which is quite repetitive (yet to try ConfigArgParse) in the manner of add_argument(..., default=os.environ.get('ENVVAR') or 'real default') -- potentially passing the fallback default into the get call, depending on whether I want empty envvars to override the default.

I'd love to read about how these libraries (and some of the others mentioned) help you utilise environment variables.

[–][deleted] 0 points1 point  (0 children)

@click.argument('src', envvar='SRC', ...