This tutorial covers the default location of the configuration sync directory,how the configuration sync directory is secured, and how to customize the location of the sync directory.
- [Instructor] Before we start synchronizing configuration, let's take a look at the default out of the box file location for staging and synchronizing configuration. In this tutorial, we'll cover the default location of the configuration sync directory, how the configuration sync directory is secured, and how to customize the location of the sync directory. When you install Drupal, the system creates a directory that handles the importing of configuration. By default, this directory lives in Drupal root slash sites default files.
It's odd to place a directory that will contain important information about your site in a web-accessible location. So, to increase security, two steps have been taken. First the new directory is named config underscore, appended with a long, unique hash. This makes it difficult for someone to mistakenly or maliciously navigate to that directory. Second the directory contains another directory named sync, which contains a hidden file called dot H-T access.
This file, read by the web server, contains instructions to ignore the existence of this directory altogether. You can change the location of your configuration sync directory if you wish. In the following example, I'll show you how to change it to a location outside of your Drupal root. We'll create a new directory, edit settings dot P-H-P, and we'll change the value of the dollar config directory's sync variable, and save our settings dot P-H-P. Allow me to demonstrate.
I'm in my Drupal root, and I want to create a new config sync directory just outside of my Drupal root, so I'm going to move up a directory, and now I'm going to make my config directory using the M-K-D-I-R command, and now I'll move into that directory and make the sync directory. So now I have a new directory for configuration sync just outside of my Drupal root. Now it's time to update settings dot P-H-P.
At the bottom of settings dot P-H-P, I already have a value for the config underscore directory's sync key, and that includes the long hash that is created by default. So I'm going to come in at this line, and create a new value for this variable. This value is going to be relative to the Drupal root, so I'll use dot dot slash to indicate that I'm just outside of the Drupal root, and then config slash sync.
I'll end the line with a semi colon, and save. In this lesson, we looked at the default location of the sync directory, how the sync directory is secured by default, and how to change that directory location and update settings dot P-H-P.
In this course you'll learn all about the new configuration system in Drupal. Explore key concepts in configuration management and important skills, such as moving configuration from a local development environment to production and using the configuration system in a module. Find out how to use command-line tools such as Drupal Console, Drush, and Git, as well as GUI tools as an alternative for tasks like cloning a site and importing and exporting site configuration.
Developers can use the demo module provided with the exercise files, Transcode Profile, to explore default configuration, custom configuration entities, administrative forms, and working with configuration entity data in a form. By the end of the course, you'll understand how you can manage configuration between instances of your site and leverage the Drupal configuration system in a module.