HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback

Configure CMS

Describes how to configure and select options in Optimizely Content Management System (CMS) through code, configuration files, or environment variables.


Configurable settings in Optimizely Content Management System (CMS) are exposed as option classes. An option class is basically a POCO C# class that is singleton registered in the DI container in the .NET Core application. More information can be found in Options pattern in ASP.NET Core.

Configure options programmatically

All options classes are registered in the service container and can therefore be injected into any service that requires this information. This also means that options values can be modified during the configuration phase of the application initialization. One common way to configure an option programmatically is to use the extension method Configure on IServiceCollection as shown below. Another alternative is to register an instance of IConfigureOptions in IOC container.

public void ConfigureServices(IServiceCollection services)
         services.Configure<DataAccessOptions>(o => o.UpdateDatabaseSchema = true);

You can find more detailed information on individual options classes under the relevant options section.

Configuration files

A common way is to have configuration values in an appSettings.json file and then bind the values from the configuration file to option classes. You can have a custom format of the configuration file and bind the values to options as described in Bind hierarchical configuration.

By following the pattern where the first element is "episerver" and then the "product" part is specified, followed by the name of the option and the values for the option, you can get binding to options automatically. Below is an example where SchedulerOptions in configuration section Cms is configured:

      "EPiServer": {
        "CMS": {
          "Scheduler": {
            "Enabled": "false"

For the option class, it is optional to have the class suffix "Options" as above where SchedulerOptions is specified as "Scheduler".

You also may find the following configuration files in a CMS installation:

  • module.config – A configuration file installed with the CMS sample templates, showing how to deploy new modules to your solution.

Environment variables

Another alternative to configure options is to have settings applied as environment variables. To get automatically binding of environment variables to options, use the same convention as in configuration files such as appsettings.json, but with '__' as a separator. Below is an environment variable that configures SchedulerOptions in configuration section Cms.


Option types

Related topics

What’s Next