One way to do it in a composer is to create your o...
# package-development
r
One way to do it in a composer is to create your own
ConfigurationBuilder
, load what you need into that and bind the options to the custom config only, something like this:
Copy code
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();
    }
4 Views