In Drupal 7 one could store every random thing not having its own table with variable_set
and retrieved it with variable_get
and life was simple. There was the $conf
variable in settings.php which allowed an easy override. This worked well... until you wanted to copy variables from one server to the other. Or translate them. In Drupal 8, most variables have moved to config()
and are still overrideable by $conf
. There are a few exceptions. Variables specific to a given environment never needing deployment should use state()
and these are not overrideable (it would make little sense as the overrides themselves are about making giving configuration variables environment specific values). The textbook example is the last time cron was run. Or the list of aggregated JS files. The list of path roots that have aliases. And so on. This is relatively rare. Even rare is the third API, variables that need to be available extremely early can be set in $settings
in settings.php and retrieved with settings()->get()
. This likely affects only people with somewhat higher end setups -- alternative cache backends, reverse proxies and the like.
Commenting on this Story is closed.
You describe settings() as config available early, which I interpret as something different than $conf inte settings.php.
Will there be any equivalent to $conf in settings.php in D8? It is very useful to have those hard overrides for a lot of things, particularly important config differences between staging and live server.
$conf is still there for overrides with only minor changes at the moment.
Updated the post clarifying this.