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

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 #1675

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Tagadda
Copy link
Contributor

@Tagadda Tagadda commented Jun 13, 2023

The problem

Solution

In ynh_add_config:

  • Backup config_panel values with yunohost app config get $app --export
  • usual ynh_add_config stuff...
  • Restore the config_panel values with yunohost app config set $app -f $file
  • Recompute and store the file hash

PR Status

Yolocommited, working with a single .env file
Need to be tested with a config_panel with multiples files

How to test

sudo yunohost app install https://github.com/Tagadda/helloworld_ynh/tree/enh/ynh_add_config/keep_config_panel_settings_during_upgrade
sudo yunohost config set helloworld max_poll_option_chars -v 666
sudo yunohost app upgrade helloworld -u https://github.com/Tagadda/helloworld_ynh/tree/enh/ynh_add_config/keep_config_panel_settings_during_upgrade
sudo yunohost config get helloworld max_poll_option_chars

@Tagadda Tagadda changed the title ynh_add_config keep config panel settings 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 Jun 13, 2023
@zamentur
Copy link
Member

This draft is fine, but I wonder if we should consider what happens if there are more complex custom setter.

Technically, there could also be several configuration files, so each call would reload the settings, which could be a bit cumbersome.

We might need an option to deactivate this behaviour ?

@zamentur
Copy link
Member

Paswrod question type could also be a problem if the getter return nothing, the export won't export the password value i think.

@zamentur
Copy link
Member

I was just thinking about an issue: what if the config panel is broken ? We probably become unable to upgrade the app no ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants