Questions tagged [configuration]
Use this tag for questions about Drupal's configuration system.
860 questions
81
votes
4
answers
92k
views
What does "The provided host name is not valid for this server" mean?
I am running a Drupal 8 website, and when I browse to any page, I get a plain white page with just the following error message on it.
The provided host name is not valid for this server.
What does ...
80
votes
7
answers
9k
views
Suggestions for settings.php - Local dev, Development server, Live server
Basically, one of the greatest questions of all time: What are some ways you're using settings.php in your development/staging workflow?
Right now, I have my settings.php file set up like the ...
73
votes
9
answers
65k
views
How can I import the configuration on a different site?
I have this error when I try to import the config of an another site:
The staged configuration cannot be imported, because it originates
from a different site than this site. You can only ...
47
votes
15
answers
48k
views
How do I remove a configuration object from the active configuration?
I'm writing a custom module for Drupal 8. It defines a field storage configuration object, in a file called modules/mymod/config/install/field.storage.bloom_stem.bs_twitter_ac.yml.
The problem is ...
41
votes
7
answers
25k
views
How do I update the configuration of a module?
I'm building a custom module in Drupal 8. It includes some YAML config files.
As I develop I need to change and add to the config, e.g. to add another field onto my custom entity.
At present the only ...
36
votes
5
answers
43k
views
Import a single yml configuration file
Is it possible to import one single configuration file by specifying its path, or a group of Yaml files contained in a specific module?
28
votes
10
answers
8k
views
How to prevent Devel module to be installed on production environments
Using the new Drupal 8 Configuration manager, how can I prevent it from installing the Devel module on certain environments? As far as I know, installing it on my local means the next time I export ...
22
votes
6
answers
31k
views
Site UUID in source storage does not match the target storage
When I run drush cim -y on my staging instance of my site I get the following error:
Drupal\Core\Config\ConfigImporterException: There were errors
validating the config synchronization. in Drupal\...
21
votes
3
answers
18k
views
How do I set a variable in the configuration file setting.php and use it from code?
How do I set a variable in the configuration file setting.php and use it from code?
19
votes
8
answers
16k
views
How can I exclude configuration from import/export?
I thought this was a simple use case of the new Configuration management system, but I haven't had any luck finding out how to solve this:
Problem
I want to store configuration in git and use drush ...
18
votes
1
answer
738
views
Technical advantages of either Configuration or Features over the other?
In short, Configuration vs Features, in Drupal 7, fight!
As always, technical advantages, or other hard facts, as we don't do discussions here. Drupal 7 specific to limit to scope, as CMI vs Features ...
15
votes
10
answers
23k
views
How do I fix a "Mismatched entity and/or field definitions" error on my configuration?
I'm getting the following error on my Drupal 8 configuration page.
Entity/field definitions
Mismatched entity and/or field definitions
The following changes were detected in the entity type and field ...
15
votes
1
answer
8k
views
How to remove mymodule configurations on uninstall [duplicate]
I have created a custom module and created a yml file to create a menu
system.menu.custom_menu.yml
id: custom_menu
label: 'Custom menu'
description: 'Custom menu.'
langcode: en
locked: true
...
15
votes
6
answers
17k
views
config-import error: These entities need to be deleted before importing
I have two Drupal environments with the same system.site:uuid
In the main Drupal I export the configuration with command:
drush config-export deploy -y
In the destination drupal I import the ...
15
votes
1
answer
4k
views
How to disable modules using config split?
I have created different split for each environement (local, dev, test, prod) using the Configuration Split module. How can manage modules (enable/disable) in each environment?
Should I keep core....
15
votes
1
answer
2k
views
What is the difference between the $config and the $settings variables in settings.php?
In the settings.php file of Drupal 8 installations, there are two different types of variables; $settings and $config. In Drupal 7 we used only $conf variable.
What's the difference between $config ...
15
votes
3
answers
442
views
How do I deploy/manage similar sites from an unique profile, without dumps?
I do not like the "cloning website" solutions which implies dumping a database and importing this dump in another environment. This does not look like a real world way of deploying several instances ...
14
votes
2
answers
13k
views
Attempt to create a field body that does not exist on entity type node
I am getting the following error:
Drupal\Core\Field\FieldException: Attempt to create a field body that
does not exist on entity type node. in
Drupal\field\Entity\FieldConfig->...
14
votes
2
answers
5k
views
What are cloned sites in Drupal 8?
When trying to export my site configurations from one Drupal 8 site to other I keep getting the following error
The staged configuration cannot be imported, because it originates
from a different ...
13
votes
2
answers
17k
views
Drupal 8 variable_get
I have some code in Drupal 7 what are using variable_get. Now I would like to write the code in Drupal 8. So I was reading this but its didn't help me a lot.
How to write this code in Drupal 8 from ...
12
votes
4
answers
10k
views
Export menu configuration [closed]
Looking for a way to export menu configuration. The Configuration management system will export the menu itself, but not the menu links configuration. I am looking for a way to put one of those mega ...
11
votes
3
answers
6k
views
How to check for differences in config
Is there any way to check for differences with config in Drush 8?
I checked the list of drush 8 config commands and I couldn't find anything.
The reason I need this is that I have a site that runs ...
11
votes
1
answer
3k
views
What order should configuration import and module updates be run?
Since the schema version of modules is stored in the key-value storage, it is unique to each site and is not synced through configuration management. That makes sense, since updates may need to make ...
11
votes
2
answers
6k
views
Exporting fields for content type
The configuration export feature of Drupal 8 would seem to be a very useful feature. However, I'm not sure I completely understand how it works.
For example, if I do a single export, choose "Content ...
10
votes
4
answers
26k
views
How do I set variables for variable_get()?
I am trying to understand variable_get(). I read so far that you can set variables in the settings.php using the $conf array and retrieve them later in code by using variable_get(). I have read that ...
10
votes
3
answers
6k
views
Manage config translations programmatically
My module creates and manages some config_entities programmatically (ie. not through an EntityForm) in response to associated content entities being saved.
In order to handle multi-language content ...
10
votes
7
answers
17k
views
Looking for Acquia Dev Desktop database settings
I am using Acquia Dev Desktop to create local Drupal installations. I am also using Bluehost as a service. Unfortunately, Bluehost uses table prefixes for Drupal tables.
So, if I import something ...
10
votes
1
answer
6k
views
Best Way to Handle Variables Per Environment
I have a custom module. It's FormBase to create a form. And on submit, I post values to an API. All this works. But I want to change the base URL variable (which is used in multiple methods) so that ...
10
votes
2
answers
3k
views
Disabling module with config sync and removing with composer
I have an issue disabling modules, I've searched but cannot find something useful:
- Developer A disable module and via composer remove it
- I pull his changes so i run composer install that remove ...
10
votes
2
answers
6k
views
Drupal Master/Slave Replication
I've setup two MySQL servers with Master/Slave replication for the drupal database and I've confirmed the databases are in sync and replicating.
I am now trying to point drupal to both databases ...
9
votes
2
answers
6k
views
Configuration export/import doesn't work
I did a drush config-export staging on a local version of my site then a drush config-import staging on the server. It imported all the taxonomy vocabulary but no terms. I also tried it via the UI (...
9
votes
6
answers
9k
views
Is there a way to clone a content type and its fields?
I have a content type named "event_xyz" that I want to rename to "event". I figure I can clone the content type and then delete the original. But I don't see any tuts or modules on how to do this.
...
9
votes
2
answers
841
views
Best way to delete all variables when uninstalling module
I'm writing a module that writes several variables (three, four variables for every content type, and other).
Which method should I use to delete them on hook_uninstall?
Is it safe to perform a ...
9
votes
1
answer
2k
views
Difference between $this->config and \Drupal::config in ConfigFormBase
I want to override a custom module configuration in the settings.php file. So the configuration in database can be independent from the environment.
$config['my_module.settings']['prop'] = 'foo';
I ...
9
votes
2
answers
808
views
How do customize settings.php during installation profile
I'm creating an installation profile for my current company internal project.
During the installation process, one of the custom modules crashes during init(), since it tries to use one global ...
8
votes
5
answers
12k
views
Unable to install the XYZ module since it requires the A module
When running (right after site install) the drush cim -y command, the following error appears:
Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization. in ...
8
votes
2
answers
6k
views
How to load field configurations in code
I have defined fields using the UI, and some more fields using YAML files in my custom module, e.g.:
The field storage is defined in field.storage.node.my_heading:
langcode: en
status: true
...
8
votes
1
answer
5k
views
YML For Enabling a Contrib Module
I am adding a contrib module to a project and I would like the module enabling to happen automatically on deployment. My deployment script pulls the code and runs a config update via drush config-...
8
votes
1
answer
2k
views
What is the difference between the config and the settings directories?
I can see a folder named config in Drupal 8 core modules which contains sub directories like optional, schema and install.
I can see it is like a settings folder which is initialised during module ...
8
votes
2
answers
640
views
Best practice for custom module variable names?
I've gotten into the habit of doing pretty robust configuration panes for my modules now, and I'm finding the variable names & management to be quite the pain.
I have variables like ...
8
votes
2
answers
483
views
Why is settings.php in the web folder?
In the default installation, settings.php is located at sites/default/. There are no recommendations in the official Drupal website about changing the location of this file. Doesn't it pose a ...
8
votes
2
answers
1k
views
Features versus Configuration Management
I am building a Drupal 8 site and I have done some research whenever I should use Configuration Management or Features to export configuration and include it in my profile.
In order to export and ...
8
votes
2
answers
2k
views
Configuration changes that will not import?
I have some configuration that will not import. If I run drush config-import --preview I see the changes to be imported; I hit 'y' to import. When I run the same command, the changes are still there?
...
7
votes
3
answers
15k
views
How do I export and import content types (including fields) between environments?
I've been trying to find a smart way of exporting content type and all its fields from one installation of Drupal to another.
The core "Configuration synchronization" export only export the content ...
7
votes
1
answer
2k
views
When to use mapping or sequence to define an array in a schema file?
I need to define an array in my onlyone.settings.yml file to store this values:
onlyone_node_types:
book: book
test: test
In my onlyone.schema.yml file I have this:
module.settings:
type: ...
7
votes
1
answer
4k
views
Does hook_install() get called before or after configuration yml files are loaded?
In Drupal 8, during module install, is hook_install() called before or after loading the .yml files in config/install?
I've across a module that's using both (which seems like a bad idea on its own) ...
7
votes
2
answers
5k
views
How to enable modules through configuration?
I am trying to enable modules by adding them to core.extension.yml file without getting involved with Features, Configuration Installer or similar modules or profiles. The modules are enabled but ...
7
votes
3
answers
3k
views
Module uninstall dependencies
I'v got a question regarding dependencies & configuration. I created a module providing a content type, field type, widget & formatter.
While wanting to uninstall the module, I get the ...
7
votes
3
answers
937
views
Overriding permissions selectively via settings.php/settings.local.php
The use case is a development module that you would only have installed on a local environment.
My thought was to use $config in settings.php to do this:
$config['user.role.anonymous']['permissions']...
7
votes
3
answers
3k
views
Config import conflict, how to remove lock
I am trying to import config on my staging site, and I repeatedly get the following message:
Another request may be synchronizing configuration already.
I know that there are no other processes ...