circus-tent / circus

A Process & Socket Manager built with zmq
http://circus.readthedocs.org/
Other
1.55k stars 257 forks source link

Allow reversal of env precedence. #799

Open meunierd opened 10 years ago

meunierd commented 10 years ago

At present, variables defined in an [env] stanza override environment variables inherited from the copy_env option in a Watcher. During development it would be useful to have the opposite pattern. So with the something like following config file:

[watcher:myapp]
cmd = ./myapp
copy_env = True
sysenv_prevails = True

[env]
FOO=bar

... I could try with a different value using FOO=baz circusd config.ini.

k4nar commented 10 years ago

As said on IRC, I wonder if this would be possible :

[env]
FOO |= bar # will be overridden if FOO is in the env
VAR = bar # will not be overridden 

It would allow doing the same thing at a finer level (per-variable) without adding another configuration option. The overriding is much more explicit with a different operator than with an option set elsewhere in the file.

The main downside is that as | would be interpreted as part of the variable's name, it would break compatibility with env variables finishing by |. But honestly, is that a thing ?

Natim commented 10 years ago

We are using INI files so I don't think it will be possible to add another operator at such level except if we want to rewrite our own INI implementation.

k4nar commented 10 years ago

Well @Natim actually I think that | will be interpreted as part of the variable name, so it's not a big deal to detect. But yeah, using a non-standard INI notation could be an issue.

Natim commented 10 years ago

Interesting if it is the case.