Skip to content

Support setting array type configs with CSV value

Michael Kozono requested to merge mk/fix-gdk-config-set-array into main

What does this merge request do and why?

I've failed to set an array type config value from the command line:

  • gdk config set gitlab.rails.allowed_hosts gdk2.test
  • gdk config set gitlab.rails.allowed_hosts "['gdk2.test']"

It doesn't appear to me like it is possible.

This MR makes gdk config set accept comma-separated values for an Array type config.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Before

➜  gdk git:(main) gdk config set gitlab.rails.allowed_hosts ""       
❌️ ERROR: Value '' for setting 'gitlab.rails.allowed_hosts' is not a valid array.
➜  gdk git:(main) gdk config set gitlab.rails.allowed_hosts gdk2.test
❌️ ERROR: Value 'gdk2.test' for setting 'gitlab.rails.allowed_hosts' is not a valid array.
➜  gdk git:(main) gdk config set gitlab.rails.allowed_hosts "['gdk2.test']"
❌️ ERROR: Value '['gdk2.test']' for setting 'gitlab.rails.allowed_hosts' is not a valid array.
➜  gdk git:(main) gdk config set gitlab.rails.allowed_hosts gdk2.test,gdk3.test
❌️ ERROR: Value 'gdk2.test,gdk3.test' for setting 'gitlab.rails.allowed_hosts' is not a valid array.

After

➜  gdk git:(main) gco mk/fix-gdk-config-set-array
Switched to branch 'mk/fix-gdk-config-set-array'
Your branch is up to date with 'origin/mk/fix-gdk-config-set-array'.
➜  gdk git:(mk/fix-gdk-config-set-array) gdk config set gitlab.rails.allowed_hosts ""              
✅️ 'gitlab.rails.allowed_hosts' is now set to '[]' (previously '["gdk2.test"]').
ℹ️  A backup of 'gdk.yml' has been made at '.backups/gdk.yml.20230412235356'.
ℹ️  Don't forget to run 'gdk reconfigure'.
➜  gdk git:(mk/fix-gdk-config-set-array) gdk config set gitlab.rails.allowed_hosts gdk2.test       
✅️ 'gitlab.rails.allowed_hosts' is now set to '["gdk2.test"]' (previously '[]').
ℹ️  A backup of 'gdk.yml' has been made at '.backups/gdk.yml.20230412235406'.
ℹ️  Don't forget to run 'gdk reconfigure'.
➜  gdk git:(mk/fix-gdk-config-set-array) gdk config set gitlab.rails.allowed_hosts gdk2.test,gdk3.test
✅️ 'gitlab.rails.allowed_hosts' is now set to '["gdk2.test", "gdk3.test"]' (previously '["gdk2.test"]').
ℹ️  A backup of 'gdk.yml' has been made at '.backups/gdk.yml.20230412235409'.
ℹ️  Don't forget to run 'gdk reconfigure'.

Impacted categories

The following categories relate to this merge request:

Merge request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise an issue to follow-up.
  • Documentation added/updated, if needed.
  • [-] Announcement added, if change is notable.
  • [-] gdk doctor test added, if needed.
  • [-] Add the ~highlight label if this MR should be included in the CHANGELOG.md.
Edited by Michael Kozono

Merge request reports

Loading