-
Notifications
You must be signed in to change notification settings - Fork 8
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
Magically keeping all custom-config panel settings during the conf upgrade via ynh_add_config
without having to define all of them as yunohost settings
#1973
Comments
I was thinking about config files that are not installed with
|
I came across an issue that is related I think. When upgrading an app where:
and
Thanks to, it should be:
See e.g. YunoHost-Apps/mautrix_whatsapp_ynh#74 (comment) Can we run config_panel_apply on the |
keep in mind this issue when refactoring #2017 |
While creating a config_panel, I though about another approach to solve this issue. |
With manifest v2 I'm currently have some duplicated information in "manifest.toml" and "config_panel.toml" like: What's about to remove the "config_panel.toml" and store in "manifest.toml" the So you have one place for both and no duplicated "code" |
Uuuh wokay but in the general case, some stuff in config panel are not install question and viceversa ... Also the config panel has the panel/section/option structure which is not present in the manifest Nevertheless there's clearly a big topic between install questions, config panel, and how to initialize settings (e.g. random keys etc) and handle backward compat' |
Yet another example today in YunoHost-Apps/fittrackee_ynh#47 ... |
Solution 1: read values, upgrade the config and rewrite values
This solution avoid having to manage a lot of template vars in
Draft: YunoHost/yunohost#1675 Solution 2 : Save by default data in settings on config panel applyingTag suggest to use super.apply(), but i noticed that values are often already registered in settings. We could discuss of the interest to save in settings when we use custom setter (or even file type). But the problem with this approach is that the config panel could never be run by the user. And we can't simply apply it before to make the Solution 3:
|
While we are at it, coule we keep in mind thé use-case of having several default configurations depending on the use-case of the server app?
This coule be different .toml or different config.yaml files
See e.g. YunoHost-Apps/synapse_ynh#403
Le 4 décembre 2023 22:02:03 GMT+01:00, Alexandre Aubin ***@***.***> a écrit :
…Yet another example today in YunoHost-Apps/fittrackee_ynh#47 ...
--
Reply to this email directly or view it on GitHub:
#1973 (comment)
You are receiving this because you commented.
Message ID: ***@***.***>
|
This would be useful for Mastodon too. We would have to choose between "public instance" where LDAP is off and registration open, and "private instance" with LDAP on and registration off etc... and this would be fed to the config panel during the install and replace the call to |
The problem
While studying config panels, I'm coming accross this one https://github.com/YunoHost-Apps/glitchsoc_ynh/blob/testing/config_panel.toml which basically expose ~10 settings from the app conf file to the config panel
The problem is that if all of these aren't declared as "actual" yunohost settings during install/upgrade, and used in the conf template, upgrading the conf file with
ynh_add_config
is gonna overwrite them during every app upgrade, which is a UX disasterHaving to handle a few additional settings during install/upgrade, but having to handle 10+ of these is boring as hell and symptomatic of how overly complex it is to expose settings in config panels
Possible solution
ynh_add_config
could have a magic mecanic such that:config_panel.toml
and identify entries binded to the target fileynh_read_var_in_file
to fetch the corresponding value forfoobar
, and store it as$foobar
(assuming $foobar) doesn't already exists ? (In fact this step and the previous one could be maybe easily handled by tweakingyunohost app config --export
maybe ? Just need to somehow limit the export to settings bound to a specific file ?)ynh_write_var_in_file
to write back the value (or maybe usingyunohost app config --import
?)This behavior could maybe be switched on/off by adding a property like
keep_during_upgrade = true/false
on each config panel setting, if that makes senseThe text was updated successfully, but these errors were encountered: