Not clear how to load Secrets in tandem with Parameter Store and bind to a class #198
-
I have this code: public class AzureOpenAIConfiguration
{
public required string Endpoint { get; set; }
public required string ApiKey { get; set; }
public void EnsureValid()
{
if (string.IsNullOrEmpty(Endpoint))
throw new InvalidOperationException("AzureOpenAI:Endpoint is required");
if (string.IsNullOrEmpty(ApiKey))
throw new InvalidOperationException("AzureOpenAI:ApiKey is required");
}
}
builder.Configuration.AddSystemsManager("/netflow", TimeSpan.FromMinutes(30));
builder.Configuration.AddSystemsManager("/aws/reference/secretsmanager/netflow/openai", TimeSpan.FromMinutes(30));
builder.Services.Configure<AzureOpenAIConfiguration>(builder.Configuration.GetSection("AzureOpenAI"));
var settings = app.Services.GetRequiredService<IOptions<AzureOpenAIConfiguration>>().Value;
var endpoint = settings.Endpoint //it's OK
var apiKey = settings.ApiKey //it's NULL My intention is to load What's wrong? Why the |
Beta Was this translation helpful? Give feedback.
Answered by
ashishdhingra
Jan 27, 2025
Replies: 2 comments
-
@JobaDiniz This has been already addressed in #199 (comment) and not reproducible. The issue is closed by you, hence I will mark this discussion as answered. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ashishdhingra
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@JobaDiniz This has been already addressed in #199 (comment) and not reproducible. The issue is closed by you, hence I will mark this discussion as answered.