Skip to content

Commit

Permalink
fix: check of verplichte configuratie empty of whitespace is
Browse files Browse the repository at this point in the history
  • Loading branch information
felixcicatt committed Oct 29, 2024
1 parent b224861 commit 1f4fbce
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ODPC.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
builder.Services.AddControllers();
builder.Services.AddHealthChecks();

string GetRequiredConfig(string key) => builder.Configuration[key] ?? throw new Exception($"Environment variable {key} is missing");
string GetRequiredConfig(string key)
{
var value = builder.Configuration[key];
return string.IsNullOrWhiteSpace(value)
? throw new Exception($"Environment variable {key} is missing")
: value;
};

builder.Services.AddAuth(options =>
{
Expand Down

0 comments on commit 1f4fbce

Please sign in to comment.