Configuration


For a large part, Redakt is configured through its pluggable module architecture. The Redakt system consists of core components, and modules that can be swapped out for other ones. All Redakt module registration is done though dependency injection in a single place, in your project's Startup.cs file. See dependency injection for a general description on how to register Redakt modules. Configuration can be either done through an app settings file, or by passing an options delegate when registering modules.

If you have not created a Redakt .NET Core project yet, please follow the project setup guide first. This guide will assume that you have a basic Redakt project in place.

Module categories

Redakt modules generally fall into one of two categories: data provider modules and feature modules. Data modules are required by the Redakt core system, and usually depend on your system infrastructural choices, such as a data store and file storage. Feature modules are optional, for example the back office module or the headless content API.

For data provider modules, a module type may have a default implementation that can be swapped out for another one, or a specific implementation needs to be configured to begin with.

Minimum configuration

The basic Redakt project setup makes some assumptions about which modules you need. The only required module that you need to specify yourself is a data store module. A data store module is the only required module that is not included in the Redakt.All meta package.

Redakt requires 4 module types to be installed and configured:

  • Data Store: this is the database where Redakt stores and retrieves your website data.
  • File Store: this is where Redakt stores and retrieves your uploaded files (media, documents, etc.).
  • Application Cache: this is where Redakt stores and retrieves cached data items.
  • Service Bus: this is how multiple Redakt instances communicate with each other in a load-balanced environment.

A default Data Store is not included in the package and should be installed separately. Depending on your targeted hosting environment, other module types may need to be installed and configured as well, or you may be able to use the default modules. See hosting scenarios for a description of several typical hosting scenarios.

Module installation & configuration

Setting up a module is generally done in 3 steps:

  • Install the appropriate NuGet package.
  • Add the module implementation to the services collection through the Redakt builder.
  • Set configuration in the appsettings.json file or through a configuration delegate.

Install the NuGet package

If you want to use a specific module implementation, you first have to install the appropriate NuGet package. You can find the NuGet package you need on the specific module's documentation page. Default module implementations are already part of the core packages and do not require any additional package to be installed. Some packages contain multiple module type implementations.

Add to services collection

Now that you have installed the module's NuGet package, Redakt needs to be informed that you will be using that package. This is done by adding the module's implementation to the services collection in the ConfigureServices method in the Startup.cs file. All Redakt modules have a single extension method that will do that for you. This is done by calling that method on the IRedaktBuilder instance returned from the AddRedakt call. You can find the exact method name on the specific module's documentation page. For example, the CosmosDB data store module would be added with the following code:

public void ConfigureServices(IServiceCollection services)
{
    // ... framework and other services here

    var builder = services.AddRedakt(this.Configuration);  // Configures Redakt core services.
    builder.AddCosmosDbDataStore();
    // ... other Redakt services
}

Set module configuration

Most modules also require some configuration to be set in the project's appsettings.json file, or through an optional Action<TOptions> delegate parameter. Consult the module's documentation for all configuration options.

Feature modules

For most websites, you will also want to add the Redakt back office, and possibly the Headless Content API for single page applications. Consult their respective documentation pages for how to configure these features.

Web configuration

Implementation

After successful configuration of your system, you can start implementing your web application. See the implementation guides for more information.