The value of any configuration option can now be overridden in the "Configuration overrides" section of your settings.php file. These settings allow you to specify override values for anything stored in configuration files as defined in the $config_directories variable (also defined in the settings.php file). This can be useful in the following situations:

  • Specify different values per-environment for a specific setting.
  • Specify sensitive data that is undesirable to be stored in the config storage.
  • Lock a specific setting that would otherwise be possible to be changed via the admin UI.

In the examples below, the first array is the name of the configuration file (without the .json extension), and the second array is the name of the setting within the configuration file:

$config['system.core']['preprocess_css'] = FALSE;
$config['system.core']['preprocess_js'] = FALSE;
$config['system.core']['file_temporary_path'] = '/tmp';
$config['update.settings']['update_emails'] = ["admin@example.com", "another@person.net"];
$config['search.settings']['search_tag_weights.h1'] = '25';

Nested settings can also be configured. For example:

  • Exact match:
    $config['system.date']['formats.long.pattern'] = 'l, F j, Y - g:ia';
  • One level up:
    $config['system.date']['formats.long'] = array(
      'pattern' => 'l, F j, Y - g:ia',
    );
  • A root level override:
    $config['system.date']['formats'] = array(
      'long' => array(
        'label' => 'Long',
        'pattern' => 'l, F j, Y - g:ia',
      ),
    );

Note: There are particular configuration values that are risky to override. For example, overriding field storage will create errors, because associated database changes are necessary. Modifying values within complicated objects such as views, content types, vocabularies, etc. may not work as expected. Use any available API functions for complex systems instead.

Introduced in branch: 
1.16.x
Introduced in version: 
1.16.0
Impacts: 
Architects, Administrators, Editors