This commit is contained in:
@@ -85,7 +85,18 @@ builder.Services.AddHttpClient();
|
|||||||
// Registrera rätt databas och identity beroende på om setup är klar
|
// Registrera rätt databas och identity beroende på om setup är klar
|
||||||
if (setup.IsConfigured)
|
if (setup.IsConfigured)
|
||||||
{
|
{
|
||||||
string connectionString = $"Server={setup.DbHost};Port={setup.DbPort};Database={setup.DbName};User={setup.DbUser};Password={setup.DbPassword};";
|
|
||||||
|
var csBuilder = new MySqlConnector.MySqlConnectionStringBuilder
|
||||||
|
{
|
||||||
|
Server = setup.DbHost,
|
||||||
|
Port = (uint)setup.DbPort,
|
||||||
|
Database = setup.DbName,
|
||||||
|
UserID = setup.DbUser,
|
||||||
|
Password = setup.DbPassword,
|
||||||
|
AllowUserVariables = true // valfritt – ta bort om du inte använder det
|
||||||
|
};
|
||||||
|
|
||||||
|
var connectionString = csBuilder.ConnectionString;
|
||||||
|
|
||||||
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
||||||
options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)));
|
options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)));
|
||||||
|
|||||||
Reference in New Issue
Block a user