-
Notifications
You must be signed in to change notification settings - Fork 52
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
Loosen config path assumptions #75
Comments
Awesome, yes, this seems great to have, especially if you have a nonstandard place where you want to keep your configuration file. Please do open a PR if you get the chance. Here are a few random ideas for the design:
|
This actually will take either a filename or a directory name. If you look in
Ah okay now I understand what you mean by config directory - yeah we can definitely alter this to continue to provide a
Yeah I'm fine with that. I'm migrating a project from configparser which reads from a list which is why I thought of doing that. This takes either a single path or a list
Ok yeah the only reason I made it different was because the config file names are different and there's that I see there's an issue about pulling from environment variables which is an idea I really like. It would feel very natural to be able to do something like this (strings assumed to be yaml files). I just get the priority between config = confuse.LazyConfig('mypkg', [
confuse.Environment('PREFIX'),
'~/mypkg',
os.path.dirname(__file__),
]) I'll submit a pull request for this when I get a few minutes! |
This all sounds great! Thanks for the extra elaboration. I like the idea of just being able to pass a list, which would be equivalent to getting the |
Jumping in to say this is great! Right now I'm doing this as a workaround so am looking forward to your 2 pr's going in
|
I think this will solve a problem that I have now - I would like to split the config into two files. Here's what I'm imagining: config = confuse.Configuration('foo', __name__, filename='config.yaml')
other_config = confuse.Configuration('foo', __name__, filename='other-config.yaml') I was considering adding the filename parameter to the Configuration init method, and it would use that or the CONFIG_FILENAME value. |
So did this ever get anywhere? |
confuse
tries to make some smart guesses about where config files are stored on the system, but it can be somewhat confusing and sometimes I would rather just hardcode specific locations that I can direct people to with certainty.Basically, I'd like to be able to just do this:
I apologize for just pasting a bunch of code, but I figured I'd illustrate the change. I was planning on submitting a pull request, but I figured I would open an issue first to discuss.
Basically, I decoupled the auto-config detection from the the class definition and now they live in 2 utility functions. Now you have the option to override the default config paths and the
Configuration
object is simpler and less dependent on the config location assumptions.The text was updated successfully, but these errors were encountered: