I have made a simple custom module in Drupal 8, in which I use a settings file (config/install/my_module.settings.yml)

I have one entry, let's say

  key: 'qsdqsd'

So when I install the module, I can use this entry in my controllers. But if I need to modify anything in this file (adding an entry, for instance...) I can't use it in my controllers (config->get(module.new_entry) returns NULL) unless I uninstall then reinstall the module.

drush cache-rebuild did not help neither.

What am I missing?


You can try the module config_sync, there you can update the site's configuration from your custom module.

afaik there is no official way to update configuration from an updated module.


The correct way to handle this would be to write a hook_update_n() function and write the code out that would add those new config keys.

Then you would run drush updb and it would be added to the website.

The other answer is correct as well. I use both together and we can track everything in GIT from dev > stage > prod in case there are changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.