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
Add feature to deprecate config options #24
Comments
Hello, is libconfuse no longer maintained? Any chance to get an update on this? |
Based on recent conversations in this repo, it seems like @troglobit is actively maintaining the library and is excited about adding new features. |
Yep, that's right! 😃 However, even your new patch monkey has limited time on his hands. But I'm more than willing to handle pull requests for this issue. I may get around to looking at this myself, but that may take some time. |
@lanoxx Did you ever implement anything for this, or did you move away from using libConfuse altogether? If you have anything, ever so small, I'm willing to take it upon myself to integrate it into the current Would love to hear back from you! 😃 |
I only opened this issue. There is no code yet. Maybe in the future I find some time to look at libconfuse code but its unlikely that will be before christmas. |
@lanoxx Ah, now I see .. completely missed this was referenced in lanoxx/tilda#161. I did not know about the I'll look into it, thank you for getting back! 😃 |
The Anyway back to this issue, support for a |
We could definitely extend 0255c50 with more bells and whistles like you describe, when However, I really like the idea of being able to deprecate settings using |
After taking a short look at the code today, I think the best approach would be to extend the If only Unfortunately this way we cannot catch the last line that being parsed, so we need to add the same code again at another place. I think there must be a nicer solution, so if someone has a suggestion let me know. I gave it a quick shot and implemented some code, its not nice but it kinda works. You can take a look at the following gist: https://gist.github.com/lanoxx/4c5b13bf7097c13cbac5 |
Interesting, thank you very much! 😃 I'll take a more detailed look at this later (probably tomorrow), integrate the patch, and see what I can do to extend it with what's missing (if anything!). Awesome work! 👏 |
Its really just a quick hack, rather then something that I would merge. If we can find a way to add another state to the parser so we can catch when the parsing of an option line has finished and we are moving to the next option, then it would be easier and we would not need that duplicate code. Anyway, let me know what you think when you look at the code tomorrow. |
@lanoxx I've played with it now a bit, it's very promising, but I'd like us to agree on the semantics first. Something I think will result in a bit different implementation. From my perspective I'd like to see the following definition:
It should not be up to libConfuse to ignore/free deprecated settings, instead I'd like to leave that granularity up to the user so they can gradually phase out settings. Something like this:
Hence, it would be up to the user of libConfuse to set up validator callback per deprecated option to decide what to do with it. Possibly we could add a new callback function for this, like for validators:
... or that could be used to simply be able to customize the deprecated warning string libConfuse would use for |
How about default callbacks and give the user the ability to override them? |
For Maybe what you really want is a per-option |
Hi @troglobit, I just saw your message.
Isn't that exactly how I implemented it, except that right now there is no
I think I am already doing that in my patch, can you clarify what exactly you want to be done different? I am not sure I understand what a As I wrote when I posted my original patch, I had trouble integrating my changes. As you can see from my comment on Oct. 29th, I had some trouble with the parser states, could you suggest a better solution than how I attempted it? Especially regarding my comment:
If I missed such a state, the please let me know, otherwise could you maybe extend the parser to add such a state? |
…P option flags - `CFGF_DEPRECATED` causes a deprecated warning message for an option - `CFGF_DEPRECATED | CFGF_DROP` causes a deprecated option to be dropped Note: `CFGF_DROP` must currently be used with `CFG_DEPRECATED` to have an effect on the option. Signed-off-by: Sebastian Geiger <sbastig@gmx.net> Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Merged, closing issue. |
We use libconfuse in tilda and often have the problem that we want to deprecate config options but this leads to problems:
When the config option is still present in the config file (e.g. for upgrading users) then libconfuse throws an error and we need to reset the config.
We are currently discussing if we replace libconfuse with another config library due to this, or if we are going to add a new feature to libconfuse. I would like to know if this project is still being actively maintained/developed and how likely it is that a patch will be accepted into libconfuse. If a patch would be accepted, then we might add a CFGF_DEPRECATED to the list of flags that causes libconfuse to ignore the config value and drop it when the config file is saved next. Possibly we could also split this into separate flags with a CFGF_DROP flag.
Please let us know what your plans with libconfuse are and if we can somehow help you.
The text was updated successfully, but these errors were encountered: