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

RFC: Add support for config-files in etc-directories #73

Open
WouterVH opened this Issue Jun 30, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@WouterVH

WouterVH commented Jun 30, 2018

Usually I create a virtualenv for my python-applications,
and I collect all config-files in an etc-directory to avoid polluting the project-directory, like this:

/opt/application-name/bin
/opt/application-name/etc/
/opt/application-name/lib
/opt/application-name/src/git-checkout

So I propose to look for config-files not only in the parent-directories, walking all the way up to root,
but also check the existence for an etc-subdirectory.

In bigger projects with lots of components, we split up the etc-dir into
.../etc/uwsgi
.../etc/supervisord
.../etc/dynaconf

As bonus we also support the global etc-directory:
/etc/settings.yml
/etc/dynaconf/settings.yml

@rochacbruno

This comment has been minimized.

Show comment
Hide comment
@rochacbruno

rochacbruno Jul 1, 2018

Owner

Great idea!

I would also include the XDR home ~/.config/dynaconf/

My only concern is when having multiple applications using dynaconf, lets say app1 and app2 each with specific configurations, dynaconf should know where to look for settings.

One options is appending in the path /etc/dynaconf/app1/ but for this DYNACONF_PROJECT_NAME must be informed as environment variable somewhere.

Owner

rochacbruno commented Jul 1, 2018

Great idea!

I would also include the XDR home ~/.config/dynaconf/

My only concern is when having multiple applications using dynaconf, lets say app1 and app2 each with specific configurations, dynaconf should know where to look for settings.

One options is appending in the path /etc/dynaconf/app1/ but for this DYNACONF_PROJECT_NAME must be informed as environment variable somewhere.

@rochacbruno

This comment has been minimized.

Show comment
Hide comment
@rochacbruno

rochacbruno Jul 1, 2018

Owner

another note is that currently this is already supported

You can explicitly do export DYNACONF_SETTINGS_MODULE=/etc/foo.yml and then Dynaconf will read the settings from that value.

DYNACONF_SETTINGS_MODULE=/etc/foo.yml,~/.virtualenvs/env/bin/python,program.py

It is not straightforward, you need to specify the path explicitly but works.

If there is a way for Dynaconf to figure out the application name and use as a path then we can avoid extra env vars.

Owner

rochacbruno commented Jul 1, 2018

another note is that currently this is already supported

You can explicitly do export DYNACONF_SETTINGS_MODULE=/etc/foo.yml and then Dynaconf will read the settings from that value.

DYNACONF_SETTINGS_MODULE=/etc/foo.yml,~/.virtualenvs/env/bin/python,program.py

It is not straightforward, you need to specify the path explicitly but works.

If there is a way for Dynaconf to figure out the application name and use as a path then we can avoid extra env vars.

@rochacbruno

This comment has been minimized.

Show comment
Hide comment
@rochacbruno

rochacbruno Sep 10, 2018

Owner

I am thinking about this one, and looks too risky to implement by default.

This should be an option explicitly set by user as export PROJECTNAME_FOR_DYNACONF=name and then dynaconf gonna look to ~/.name , ~/.config/name, /etc/name/ etc...

Owner

rochacbruno commented Sep 10, 2018

I am thinking about this one, and looks too risky to implement by default.

This should be an option explicitly set by user as export PROJECTNAME_FOR_DYNACONF=name and then dynaconf gonna look to ~/.name , ~/.config/name, /etc/name/ etc...

@rochacbruno rochacbruno changed the title from Add support for config-files in etc-directories to RFC: Add support for config-files in etc-directories Sep 21, 2018

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