Hi,
I'm trying to bring SS3 config code more in line with the new config system. How can I set configuration values of a module outside of the module's _config/*.yml?
For example, a problem I'm trying to address is that I'm making changes to the silverstripe-googlesitemaps default configuration ie google_notification_enabled=true.
googlesitemaps/_config/googlesitemaps.yml
---
Name: googlesitemaps
---
GoogleSitemap:
enabled: true
objects_per_sitemap: 1000
google_notification_enabled: true
use_show_in_search: true
Everytime I run a composer update and a new version is downloaded, the settings that I've made are replaced with the module's default. Of course, I can merge them back after a source control diff but I'm wondering if there is a better way to do it.
Previously, in /mysite/_config.php, I'd call GoogleSitemap::enable_google_notification(); which is now deprecated. But I could simply place the new equivalent in /mysite/_config.php:
Config::inst()->update('GoogleSitemap', 'google_notification_enabled', true);
Is this the best/only approach? Or is it better to stick with modifying the _config/googlesitemaps.yml to keep in line with the new Config approach and get the performance benefits. Or would the performance benefits be negligible ?
Also from what I read in the documentation, the _config/ directory containing the YAML files seemed to be focused on modules. Another approach could be a mysite/_config/sitewide.yml where we can do site wide overrides of modules' default configuration variables? If so what would the syntax be to modify another module's configuration values?
Thanks.
Kind regards,
VWD.