I add the following to the end of my settings.php
$config['system.site']['name'] = 'Drupal 8 DEVELOPMENT';
When I run
drush cget system.site name it still displays the old site name.
Any idea why it wouldn't be overriding?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
This is intentionally.
settings.php doesn't change the configuration in database. It overrides the configuration only for the actual request.
If you remove the line from settings.php, you restore the configuration to the original value.
You can even edit the original configuration in UI, while it is overridden in settings.php.
You can check this:
drush ev "var_dump(\Drupal::config('system.site')->get('name'))"
has the result: Drupal 8 DEVELOPMENT
But if you use these commands:
drush cget system.site name // is the same as drush ev "var_dump(\Drupal::configFactory()->getEditable('system.site')->get('name'))"
the result will be the site name configured in Basic site settings.
Because I haven't found it spelled out clearly anywhere in the docs, I'm gonna write it here for posterity.
$configto override a value which you would access from
$settingsto override a value which you would access from
\Drupal::state()cannot be overridden from settings.php