Sitecore 9 has divided the configuration in layers and currently there are 4 layer.
- Sitecore
- Module
- Custom
- Environment
Sitecore Folder
This folder is reserved for Sitecore used only. This contain the configurations file for Sitecore components as feature. You must not change the order of Configurations files, Changing default load order can cause components to stop working.
Modules Folder
This folder is reserved for Sitecore used only. This contain the configurations file for Sitecore module, such as WFFM. When you install any new module, its configuration file are added to it associated folder under Module folder. Also the layer.config file got updated.
Custom Folder
This contain the patch files you create in order to modify the default setting in default Sitecore configurations.
Environment
This contains patch files that are created for different Environment (QA, Productions) such as Logging.
Load Order of Configurations file.
- Web.Config
- ConnectionString.Config
- Layers.config
Rule-based configuration
Sitecore come with 2 Pre-Defined Rule Definitions.
- Server Role
- Search Rule
- Custom Rule
Server Role
Determine the Server Role on which instance it running. Below are the Five Server Role.
- ContentManagement
- ContentDelivery
- Processing
- Reporting
- StandAlone
Default Value is StandAlone, which can perform all the server role.
You can change the role, by going into the Web.cofig
<AppSettings>
<add key="role:define" value="StandAlone"/>
</AppSettings>
From here you can also apply multiple role for CM Setup
<AppSettings>
<add key="role:define" value="ContentManagement, Processing, Reporting"/>
</AppSettings>
Search Rule
Sitecore come with the 3 default search
- Solr
- Lucene
- Azure
By Default is the Lucene search.
You can set the value of search, by going to AppSetting file.
<AppSettings>
<add key="search:define" value="Solr" />
</AppSettings>
Custom Configuration
You can configure the particular setting to determine the condition.
In appsetting we define the Enviroment as “QA”
<appSettings>
<add key="localenv:define" value="QA">
</appsettings>
Now in the custom configuration file, you just need to add the “localenv:require” attribute.
<?xml version="1.0"?>
<configuration xmlns:env="http://www.sitecore.net/xmlconfig/ localenv /">
<sitecore>
<settings>
<setting name="Email.SMTP" value="Local" localenv:require="Local" />
<setting name=" Email.SMTP" value="QA" localenv:require="QA" />
</settings>
</sitecore>
</configuration>
As mentioned above you can also use multiple setting at the same time.
<?xml version="1.0"?>
<configuration xmlns:env="http://www.sitecore.net/xmlconfig/ localenv /">
<sitecore>
<settings>
<setting name="Email.SMTP" value="Local" localenv:require="Local" role:require="Standalone" />
</settings>
</sitecore>
</configuration>
ShowConfig.aspx
As you as aware using the showconfig.aspx url, you can view the all the configurations setting of Sitecore.
In Sitecore using this file you can simulate the changes to roles, layer and Custom rules.
http://<sitename>/sitecore/admin/showconfig.aspx?layer=Sitecore|Modules|Custom|Environment&role=ContentManagement|Processing|Reporting&localenv=QA|Test
Sitecore has provide a new Sitecore admin tool, Showconfiglayers.aspx
You can find more details information in this blog.
Reference