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

Update config file? #130

Open
ideal2545 opened this issue Apr 29, 2021 · 3 comments
Open

Update config file? #130

ideal2545 opened this issue Apr 29, 2021 · 3 comments

Comments

@ideal2545
Copy link

Pretty new to python, I've been trying to read through the documentation, I am able to 'set' a parameter but that is only in runtime not actually updating the corresponding value in the yaml file, is there a relatively easy way to do this? I tried reading through the documentation and ran accross set_file but I havent had much luck.

@ideal2545
Copy link
Author

For the record I can do this with just dumping and ovewriting the yaml with config.dump by opening the file, writing to it and then closing it, but I was wondering if there was a more elegant solution provided by confuse (which is awesome by the way)

@vbrozik
Copy link

vbrozik commented Apr 29, 2021

I totally agree. The documentation is missing this important information:

  • How do you update the configuration file?
  • How do you select to which configuration file to write the changes? (As confuse should combine the configuration from multiple files.)

The example application is missing this functionality too.

@sampsyo
Copy link
Member

sampsyo commented Apr 29, 2021

Hello! I think the reason this is confusing is that this is not really a feature that Confuse has… it can format the "combined" configuration as a user-visible YAML file, but it doesn't have a direct facility to write this new configuration back to a file. So I have two thoughts:

  • If anyone is already using Confuse in this way (taking its formatted YAML output and writing it back to a file manually), maybe they'd like to contribute an example of how to do that correctly?
  • We could consider it a "feature request" to make this something we support as a first-class feature. But this would require some design effort… I don't think it's obvious how this functionality should work, and it would need careful thought before it's ready to implement.

@iamkroot iamkroot mentioned this issue May 11, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants