-
Notifications
You must be signed in to change notification settings - Fork 10
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
Preserve Comments and Formatting in Configuration Files After Web Interface Modifications #166
Comments
@jojo141185 serde_yaml wont support comments. So it would not possible to keep them. I looked for other libs and it seems it is not possible to guarantee that comments would be available when serialized. You are right about toml, it seems the crate toml_edit can preserve comments. I personally dont like toml syntax, but we could make it configurable to decide what the user prefers. |
@euzu While testing the WebUI to change some configs today, all my comments and the overall structure of my rather complex configuration files were completely lost. This was a bit frustrating and the reason I thought it might be worth discussing the topic and submitting a feature request or at least keeping an eye on the problem. But you're absolutely right that it's not strictly necessary to make this change, and introducing two different configuration formats could potentially confuse many users. I would not recommend that. Moreover, it would generate a lot of work that could be better used for useful new features. For me, the format itself isn't as critical. However, I did come across an interesting article a while ago, which pointed out some pitfalls with YAML that should be kept in mind . In comparison, TOML has fewer such pitfalls, though ultimately, it's a matter of personal preference based on what one is accustomed to and prefers to use. We could certainly keep this in mind as a potential improvement for the future, and if a more optimized YAML library with features comparable to toml_edit becomes available, we can reconsider it. |
Good point, I didn't look for configs backup in data folder 👍 |
@euzu does this relates to what we discussed about the format the webui uses vs the one that is in the wiki which i like more as it looks cleaner and more space efficient? |
Is your feature request related to a problem? Please describe.
After making changes to the configuration via the web interface and saving it, all existing comments and formatting (e.g., CR) are removed, leading to the loss of important comments and structure in the configuration file.
Describe the solution you'd like
The goal is to preserve the existing comments and ensure that the formatting/structure of the configuration file remains intact. One potential solution is to switch to TOML as the configuration format, which better supports the preservation of comments and formatting. A library like
toml_edit
can be used to manipulate TOML files while retaining comments and formatting.Alternatively, if YAML continues to be used, it would be necessary to explore a more flexible library that allows comments and formatting preservation during updates, similar to how
toml_edit
works for TOML files.Describe alternatives you've considered
toml_edit
.Additional context
Switching to TOML, along with a library like
toml_edit
, would likely resolve this issue by ensuring that valuable information like comments or formatting is not lost when configuration changes are applied through the web interface. If YAML is preferred, further investigation into suitable libraries for comment preservation would be necessary.The text was updated successfully, but these errors were encountered: