Skip to content

Commit d6f6c76

Browse files
committed
Validate Database:Server/User/PostgresDatabase non-empty in AppRegIdentity
1 parent 4b7c021 commit d6f6c76

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

api/Configurations/CustomServiceConfigurations.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -365,19 +365,19 @@ private static void ConfigureDatabaseWithAppRegIdentity(
365365
IConfiguration configuration
366366
)
367367
{
368-
var server =
369-
configuration["Database:Server"]
370-
?? throw new InvalidOperationException(
368+
var server = configuration["Database:Server"];
369+
if (string.IsNullOrWhiteSpace(server))
370+
throw new InvalidOperationException(
371371
"Database:Server is required for AppRegIdentity auth."
372372
);
373-
var postgresDb =
374-
configuration["Database:PostgresDatabase"]
375-
?? throw new InvalidOperationException(
373+
var postgresDb = configuration["Database:PostgresDatabase"];
374+
if (string.IsNullOrWhiteSpace(postgresDb))
375+
throw new InvalidOperationException(
376376
"Database:PostgresDatabase is required for AppRegIdentity auth."
377377
);
378-
var dbUser =
379-
configuration["Database:User"]
380-
?? throw new InvalidOperationException(
378+
var dbUser = configuration["Database:User"];
379+
if (string.IsNullOrWhiteSpace(dbUser))
380+
throw new InvalidOperationException(
381381
"Database:User is required for AppRegIdentity auth."
382382
);
383383

0 commit comments

Comments
 (0)