Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Allow a configuration file to be determined via ENVIRONMENT vars #742

Open
jvanasco opened this issue Apr 19, 2016 · 7 comments · May be fixed by #917
Open

Suggestion: Allow a configuration file to be determined via ENVIRONMENT vars #742

jvanasco opened this issue Apr 19, 2016 · 7 comments · May be fixed by #917

Comments

@jvanasco
Copy link

I am willing to submit a PR for this if the idea is acceptable.

Currently the configuration file is determined by this logic:

  • -c argument
  • search on default locations

I suggest the following change:

  • -c argument
  • SUPERVISOR_CONFIG environment variable
  • search on default locations
@mnaberez
Copy link
Member

This has been requested several times now. I was initially against it because locating the config file is already quite complicated, but I have come around. It's clear from other tickets that this would be useful for some situations. If a patch is submitted with tests, I will merge it. I agree with your suggested order. I think the SUPERVISOR_CONFIG environment variable should behave like -c, i.e. if it is specified and the file is not found, exit with an error message.

@blaketmiller
Copy link

For another use case, I'm in an environment where I do not have root privileges, and thus, everything gets installed locally in my home directory. Therefore, I cannot place my config file in any location that supervisor expects. Setting an environment variable would absolutely solve my problem and allow me to still use supervisor.

The other solution would be to add any/all of the following to the search path (http://supervisord.org/configuration.html#configuration-file):

  • ~/supervisord.conf
  • ~/etc/supervisord.conf
  • ~/etc/supervisor/supervisord.conf

That ought to be an easy feature to add too. Thoughts?

@mnaberez
Copy link
Member

The other solution would be to add any/all of the following to the search path

I'd be more inclined to just add something like SUPERVISOR_CONFIG rather than piling more paths onto the search list.

@blaketmiller
Copy link

Well how about just ~/etc/supervisord.conf instead of all three? :)

For what it's worth, looks like it's a single line addition:

searchpaths = [os.path.join(here, 'etc', 'supervisord.conf'),
os.path.join(here, 'supervisord.conf'),
'supervisord.conf',
'etc/supervisord.conf',
'/etc/supervisord.conf',
'/etc/supervisor/supervisord.conf',
]

@mnaberez
Copy link
Member

My preference would be to stop growing the search list and just do something like the environment variable. You could set that in .profile or equivalent and then put the file wherever you like.

@jvanasco
Copy link
Author

This is still on my queue, I just haven't had time work on a PR.

@blaketmiller depending on your needs, you can just use a shell alias or edit a startup script to explicitly pass in the config file via -c. I wanted the ENV variable because supervisor is run in it's own virtualenv, so it makes more sense for future maintenance to consolidate customizations via ENV vars.

@WhyNotHugo
Copy link

I like the idea of having the config file in a user's home directory (as suggested by @blaketmiller), but I'd much rather use an XDG-conformant location (eg: .config/supervisor/supervisor.conf).

As far as the default location goes; the issue with the current list of locations, is that none of them are user-writeable; all of them require root permissions, and are system-wide.

Anyhow, I'm also okay with the ENV variable proposal too, since either would work for me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants