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?

2 Answers 2


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.


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 "official" way to handle data schema changes in an updated module is to use a hook_update_N().
    – anonymous
    Commented Feb 2, 2022 at 22:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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