101

This error message is coming from a feature that was added to Drupal 8 to protect against HTTP Host header attacks. The feature is also described in the change record that was generated for the patch. Essentially, it was possible to spoof the HTTP Host header for nefarious purposes, and trick Drupal into using a different domain name in several subsystems (...


90

Youu can get the UUID with drush config-get "system.site" uuid. You can change it with drush config-set "system.site" uuid [uuid].


56

The easiest way to do this at the moment is to use drush php (or core-cli) to open an interactive session. Then use: Drupal::configFactory()->getEditable('system.menu.devel')->delete(); This functionality will be added into Drupal console as well.


38

The easiest way is to ensure that the config has a dependency on your module. dependencies: module: - yourmodule enforced: module: - yourmodule Then Drupal will automatically remove that configuration and also warn in the UI that it will be removed. Note that this only works for new installations, it won't fix existing ones. An ...


33

Drush command to delete configuration object: drush config-delete <config_name>.


31

As mentioned in the original question, and follow-up comments, there are a variety of contrib modules and manual methods to accomplish this. To do it automatically, or in a custom fashion, I think hook_update_N() is still probably the most viable option. For instance, this is an example from the Head 2 Head to update system.site to set the default_langcode:...


24

You can use $ drush cim --partial --source=only-few-configs/ Your help says: $ drush cim --help Import config from a config directory. Examples: drush config-import --partial Import configuration; do not remove missing configuration. Arguments: label A config directory label (i.e. a key in $...


21

The Configuration Management only allow sync configuration between same site or project to avoid issues importing configuration from site a.com to b.com, to accomplish this validation Drupal 8 generate a UUID for each site. You cat get your current site UUID executing the following command: drush cget system.site The command above we will have a similar ...


20

In Drupal 7 $data = variable_get('test_content_types'); In Drupal 8 $data = \Drupal::state()->get('test_content_types'); For more information about about "get", "set", "delete" visit - Step 5: How to upgrade D7 variables to D8's state system.


18

Method: Drush Drush can ignore the enabled states of extensions when synchronizing configuration. drush cex --skip-modules=devel drush cim --skip-modules=devel With Drush CMI tools you can operate with a list of configuration to ignore. drush cexy --ignore-list=/path/to/config-ignore.yml drush cimy --delete-list=/path/to/config-ignore.yml Method: ...


18

You can import one configuration by running the following command: drupal config:import:single If you are trying to run multiple import you can create a chain for that. Command Documentation - config:import:single


17

I've found this Gist on GitHub, which reverts/reloads given module's configuration using drush: drush cim -y --partial --source=modules/path/to/module/config/install/


15

You can use the following methods. Use the following code in hook_uninstall Drupal::configFactory()->reset('field.storage.bloom_stem.bs_twitter_ac'); OR in the yml file you can put the dependencies like dependencies: module: - yourmodule enforced: module: - yourmodule then drupal will automatically remove this configurations on ...


15

You can use the "Config Ignore" module: https://www.drupal.org/project/config_ignore Ever experienced that your site's configuration was overridden by the configuration on the filesystem, when doing a drush cim? Not anymore! This module is a tool to let you keep the configuration you want, in place.


14

I have migrated other CMS's to Drupal and had experience moving user accounts. Drupal's password algorithm is extremely good. The salt you are referring to in the settings.php is not used for passwords. The drupal_hash_salt salt is used for generation of things like cookies. Hence why it says you must keep it the same across all web servers if you are in ...


14

Using Drupal Console You can override your current site's UUID with the value present in the configuration you want to import. You can achieve this with Drupal Console by overriding the uuid key for system.site. drupal config:override Then enter system.site for the configuration name, uuid for the configuration, and the UUID value, when prompted for each of ...


13

As others have mentioned, you must set the permissions on the /sites/default folder. The default permissions are set to 0555, set them to 0755 for editing. Don't forget to restore the default values afterwards!


13

Cloned site means that you copied the database instead of installing twice from scratch. Drupal identifies two different sites as cloned sites by checking their uuid. If the uuids match, then it will assume that the sites are cloned instances. Faulty configuration imports can lead to broken sites which we may not be able to restore. Hence to avoid this ...


13

As I landed on this question as well but did not really find the correct answer for my situation here, I'd like to add another answer. Please note: Anti-pattern ahead! Use case When we're developing projects we constantly update our test / acceptance environment with new configuration updates. Take for example a simple fictional News-module, we'd like to ...


13

Configuration management is exporting exactly what it was designed to do: Export the configuration settings. The actual taxonomy terms themselves are sitting in the taxonomy_term_field_data table in the database.


13

You can create a new setting in your settings.local.php or settings.php file like: $settings['event_base_url'] = 'https://www.example.com'; or some people are adding switch block based on the server host, e.g.: switch (@$_SERVER['HTTP_HOST']) { default: case 'dev.example.com': $settings['event_base_url'] = 'http://dev.example.com'; break; ...


12

Updates must be run before configuration is imported A pending issue against core will ensure that the code and schema versions match before allowing configuration to be imported. Problems with config import before updates An update hook relying on a configuration value could end in a different result than if it were run on the pre-import value. An update ...


12

You can fix this by changing your local site UUID using drush. I also needed to run a mix of drush entity-updates -y and installing specific modules with drush en <module_name> -y before the configs would import on a new fresh database. Update: you shouldn't use drush entity-updates -y anymore. See https://www.drupal.org/node/3034742


12

To enable a module, you just need a line in core.extension.yml. However, you also need all the configuration the module provides. You could copy that over yourself from the config install and optional folder. But the usual workflow is that at you enable the module manually at some point, using drush or the UI, then optionall customize the configuration and ...


12

The answer from @Smartsheet eng is correct if you want to load and read a specific translation as a config entity, see also How to progragrammatically get NodeType translated value in D8?. However, changing them is different, because the config entity can't be saved like that, it doesn't understand what is a translation and what's not. It will just ...


11

It's the same: The variable_set function saves the variable to database serializing it. variable_get takes the variable from $conf where the variable is already unserialized. Example: $var1 = array( 'key1' => 'value1', 'key2' => 'value2' ); variable_set('var1', $var1); print_r variable_get('var1'); Output Array ( [key1] => value1 [...


11

This happens because trusted_host_patterns variable in your settings file. If you're working on the local environment and you want to override this, define the following section in your settings.local.php file: /* * Drupal Trusted Host Patterns */ $settings['trusted_host_patterns'] = []; Or more generic pattern: $settings['trusted_host_patterns'] = [ '.*...


11

You can get the site UUID without access to the site or database. If you don't have access to the original site/database, you can still sync from provided config files. The config will contain your site's UUID, so you need to set that first. Find your config/sync directory: If it's moved, you can find where it was set in settings.php. Look for: $...


11

You attempted to create a field using configuration without creating the field storage configuration. In the field configuration YAML you can see a field_storage property. That is the id of the field storage configuration that needs to also be imported.


11

The terminology is a bit confusing (as usual with Drupal), but here goes: Field storage configurations are defined by FieldStorageConfig. To load one, do this: $field = Drupal::entityTypeManager()->getStorage('field_storage_config')->load('node.my_field'); Field instance configurations are defined by FieldConfig. To load one, do this: $...


Only top voted, non community-wiki answers of a minimum length are eligible