Custom Configurations

Configuration is currently not supported for Cake Frosting.

Besides the built-in configurations that are available in Cake, it is possible to use custom configurations.

Like the built-in configurations, custom configurations are also separated in sections and keys.

Accessing a configuration value

Configurations can be accessed by using IConfiguration.GetValue. The section and the key need to be separated by an underscore (_). Access to configurations is case insensitive.

var value = Context.Configuration.GetValue("MySection_MyKey");

Setting a configuration value

# Set an Environment variable by prefixing 'CAKE_'
# and separating section and key with an underscore.
[Environment]::SetEnvironmentVariable("CAKE_MYSECTION_MYKEY", "MyValue" [EnvironmentVariableTarget]::User)

; Use the ini-format to set a section and provide key-value-pairs.
[MySection]
MyKey=MyValue

# provide the setting as option to the command line
# by separating section and key with an underscore.
dotnet cake build.cake --MySection_MyKey=MyValue