fix: remove hardcoded admin seed password from Program.cs
Replace the 'Admin123!Pass' fallback with an InvalidOperationException that requires Seed:AdminPassword from config or SEED__ADMIN_PASSWORD env variable. Keeps the env var fallback as second option before throwing.
This commit is contained in:
1 parent
ec50f6635e
commit
80b592ba04
1 file changed
+1
-1
@@ -149,7 +149,7 @@ using (var seedScope = app.Services.CreateScope())
|
||||
};
|
||||
var adminPassword = builder.Configuration["Seed:AdminPassword"]
|
||||
?? Environment.GetEnvironmentVariable("SEED__ADMIN_PASSWORD")
|
||||
?? "Admin123!Pass";
|
||||
?? throw new InvalidOperationException("Seed:AdminPassword is required in config or SEED__ADMIN_PASSWORD env var. This is only needed for Development seeding.");
|
||||
await userManager.CreateAsync(testAdmin, adminPassword);
|
||||
await userManager.AddToRoleAsync(testAdmin, AppRoles.Admin);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user