ddev: Override in config.*.yaml of false/null/empty values does not work anymore in v1.20.0
Is there an existing issue for this?
- I have searched the existing issues
https://gist.github.com/cmuench/6c633b58d33ec9fcf802b6bc2dda551e
Current Behavior
I have the NFS mount enabled in the projects .ddev/config.yaml
file.
In a .ddev/config.local.yaml
the setting is set to false
.
If I start the project then the NFS mount is used.
A ddev debug configyaml | grep nfs
prints nfs_mount_enabled: true
.
I also tested with other values likes “timezone” or “composer_version”. That values are overridden as expected. My suggestion is that the NFS mount config has a different handling since v1.20.0
Expected Behavior
If value in config.local.yaml file should override. NFS mount should not be used in the project.
Steps To Reproduce
- Create project
- Set “nfs_mount_enabled” to true in config.yaml
- Create a config.local.yaml and set “nfs_mount_enabled” to false
- Start the project
- NFS mount is used
Anything else?
It’s currently only nfs_mount_enabled affected.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (11 by maintainers)
@rfay , many thanks, it works with
override_config
parameter.He mentions yq, which is a great idea, since yq is small, and allows us to test for a particular item in the yaml. Suppose we defined a special key/value pair for
config_override
, where we behaved as if the default wasfalse
. Then for shell files, we could test if a yaml file containedconfig_override: true
and special case its processing. Note this is easy enough to do in Go directly, since we can parse in a file as map[string]any and do the same test. We’d then handle a config.*.yaml file according to whether the setting was present or not, using the current merging code if present, and doing a straight override if not.This would remove any need for a special delete-this-setting syntax. The file would be all merge or all replace. Which I think is a simpler dev experience.
One feature of Mergo that may come in handy for this: it turns out to be extremely simple to convert a struct into a map[string]any. Run this by a type switch, and you have very easy compare of the scalar fields. Not sure if you can make a round trip with this, but if it’s possible, then the code to handle the compares becomes very simple.
The issue here is only “turning off” a boolean feature, yes. Turning on should still work fine.