-
-
Notifications
You must be signed in to change notification settings - Fork 287
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 via dynaconf-xdg plugin
#73
Comments
Great idea! I would also include the XDR home My only concern is when having multiple applications using dynaconf, lets say One options is appending in the path |
another note is that currently this is already supported You can explicitly do
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. |
I am thinking about this one, and looks too risky to implement by default. This should be an option explicitly set by user as |
As far as I understand |
Regarding etc directories. I think, there is a need to have a separate configuration for dynaconf itself and separate configurations for apps. This might be related to #108. At least how I use dynaconf is that first I want to customize dynaconf behavior first. Currently I do that by creating my own customized So maybe it would be a good idea to have a separate configuration file for dynaconf itself? Search locations could follow xdg basedir-spec. Example [dynaconf.global.default]
merge_enabled = true
[dynaconf.app1.default]
project_root = "/etc/app1"
global_env = "app1"
[dynaconf.app1.development]
project_root = "{cwd}" |
@sirex I'm facing the same problem. I also checked in the code and the usage of the variable doesn't seem to relate to anything connected to file discovery. It always uses the os.getcwd() |
Thi issue is being resolved on #143 |
That is decided that this feature will be added as a Then, to implement this user will have to: $ pip install dynaconf
$ pip install dynaconf-xdg When that plugin is installed, then dynaconf will read ~/.dynaconf/conf.toml
~/.config/dynaconf/conf.toml
/etc/dynaconf/conf.toml The above will be dynaconf [dynaconf]
enable_x = true Each application ( ~/.dynaconf/app1/settings.toml
~/.config/dynaconf/app1/settings.yaml
/etc/dynaconf/app1/.secrets.json If plugin is simply installed, this is included to The name |
dynaconf-xdg plugin
Now Dynaconf has changed and it is required to pass explicitly the location for the config files to be loaded. https://www.dynaconf.com/#using-python-only So the user is responsible for passing the value for XDG and this is not controlled by dynaconf. from xdg import XDG_CONFIG_HOME
settings = Dynaconf(
settings_file=os.path.join(XDG_CONFIG_HOME, "myfile.yaml|toml|ini|json|py")
) |
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
The text was updated successfully, but these errors were encountered: