How to get (check) drupal configuration value ?
How to set drupal configuration value ?
How to Override drupal configuration value from setting.php file ?
How to exclude a module configuration ?
Get, Set and Delete configuration value by drush
Get (drush config-get)
drush cget CONFIG_NAME CONFIG_KEY
Examples:
drush cget system.site
drush cget system.site page.front
Set (drush config-set)
drush cset CONFIG_NAME CONFIG_KEY CONFIG_VALUE
Example:
drush config-set system.site page.front node
Delete (drush config-delete)
drush cdel CONFIG_NAME
Example
drush cget mymodule.test
Export config to files (drush config-export)
drush cex -y
Import Config from files (drush config-import)
drush cim -y
Configuration override from Settings.php
You can override configuration from settings.php files.
Examples :
- Disable CSS/JS compress on local / development envirenement.
$config['system.performance']['css']['preprocess'] = 0;
$config['system.performance']['js']['preprocess'] = 0;
Exclude a module (Drupal > 8.8)
For example, to exclude devel and stage_file_proxy, add this to settings.php
$settings['config_exclude_modules'] = ['devel', 'stage_file_proxy'];
Configuration Split
Also see the contrim module Configuration Split for more options
https://www.drupal.org/project/config_split
Link : https://www.drupal.org/docs/8/api/configuration-api/configuration-override-system
Comments1
How to add new Congig key into existing config.
I have one custom module with config data.
mymodule
-- config/mymodule.yml
--
mymodule.yml
apikey: xxxxx
apisecret: xxxxx
Now, I have install this module.
After, I want to add one more config key in YML file. For that drupal suggest, first uinstall module, add new key in configuration file, reinstall module.
After, cache clear it will work.
Question: is there any other alternative, so I shouldn't uninstall mymodule?
Thanks