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

  1. Create project
  2. Set “nfs_mount_enabled” to true in config.yaml
  3. Create a config.local.yaml and set “nfs_mount_enabled” to false
  4. Start the project
  5. 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)

Most upvoted comments

@rfay , many thanks, it works with override_config parameter.

A proposal for a technique:

* [Provide feature flag for overriding config.*.yaml instead of merging #4100](https://github.com/drud/ddev/issues/4100)

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 was false. Then for shell files, we could test if a yaml file contained config_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.