-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
I have a single key value that I want to read (consul) in alongside the appsettings.json file(not consul)
The value is a string representation of a boolean (true, false)
but when calling the injected _configuration["test-key"] from within the controller I am not getting any result.
Can I please have some guidance of what is potentially happening? I don't see any exeptions in the logs.
public static IWebHostBuilder CreateWebHostBuilder(string[] args, CancellationTokenSource cancellationTokenSource) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureAppConfiguration(
(hostingContext, builder) =>
{
builder
.AddConsul("test-key",
cancellationTokenSource.Token,
options =>
{
options.ConsulConfigurationOptions =
cco => { cco.Address = new Uri("http://127.0.0.1:8500"); };
options.Parser = new SimpleConfigurationParser();
options.Optional = false;
options.ReloadOnChange = true;
options.OnLoadException = exceptionContext =>
{
Console.WriteLine($"{exceptionContext.Exception}");
exceptionContext.Ignore = true;
};
})
.AddEnvironmentVariables();
})
.ConfigureKestrel(options => { options.Limits.MinResponseDataRate = null; })
.UseStartup<Startup>()
.UseNLog();
consul sturcture would be
test-key:test-value
features/feature1:true
features/feature2:false
How am I able to get just keys prefixed by features?
Metadata
Metadata
Assignees
Labels
No labels