rasmusjp
10/14/2021, 4:25 PMConfigurationBuilder
, load what you need into that and bind the options to the custom config only, something like this:
csharp
public class MyComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
var configuration = new ConfigurationBuilder()
.AddJsonFile("my-json-config.json", true, true) // loads my-json-config.json
.AddEnvironmentVariables("MyPrefix:") // load environment variables prefixed with MyPrefix__ (note: prefix will be stripped from name in the configuration, sa MyPrefix__MyValue becomes MyValue)
.Build();
builder.Services.AddOptions<MyOptions>()
.Bind(configuration) // bind the configuration to the options
.ValidateDataAnnotations();
}