mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-09 15:06:37 +08:00
fix: Fix the issue where remote databases cannot be selected during application installation (#9589)
This commit is contained in:
parent
3110d91bf6
commit
1c22e1cf99
1 changed files with 4 additions and 1 deletions
|
@ -177,7 +177,7 @@ func createLink(ctx context.Context, installTask *task.Task, app model.App, appI
|
||||||
if password, ok := params["PANEL_DB_ROOT_PASSWORD"]; ok {
|
if password, ok := params["PANEL_DB_ROOT_PASSWORD"]; ok {
|
||||||
if password != "" {
|
if password != "" {
|
||||||
database.Password = password.(string)
|
database.Password = password.(string)
|
||||||
if app.Key == "mysql" || app.Key == "mariadb" {
|
if app.Key == "mysql" || app.Key == "mariadb" || app.Key == constant.AppMysqlCluster {
|
||||||
database.Username = "root"
|
database.Username = "root"
|
||||||
}
|
}
|
||||||
if rootUser, ok := params["PANEL_DB_ROOT_USER"]; ok {
|
if rootUser, ok := params["PANEL_DB_ROOT_USER"]; ok {
|
||||||
|
@ -282,6 +282,9 @@ func createLink(ctx context.Context, installTask *task.Task, app model.App, appI
|
||||||
}
|
}
|
||||||
case constant.AppMysql, constant.AppMariaDB, constant.AppMysqlCluster:
|
case constant.AppMysql, constant.AppMariaDB, constant.AppMysqlCluster:
|
||||||
oldMysqlDb, _ := mysqlRepo.Get(repo.WithByName(dbConfig.DbName), repo.WithByFrom(constant.ResourceLocal))
|
oldMysqlDb, _ := mysqlRepo.Get(repo.WithByName(dbConfig.DbName), repo.WithByFrom(constant.ResourceLocal))
|
||||||
|
if oldMysqlDb.ID == 0 {
|
||||||
|
oldMysqlDb, _ = mysqlRepo.Get(repo.WithByName(dbConfig.DbName), repo.WithByFrom(constant.AppResourceRemote))
|
||||||
|
}
|
||||||
resourceId = oldMysqlDb.ID
|
resourceId = oldMysqlDb.ID
|
||||||
if oldMysqlDb.ID > 0 {
|
if oldMysqlDb.ID > 0 {
|
||||||
if oldMysqlDb.Username != dbConfig.DbUser || oldMysqlDb.Password != dbConfig.Password {
|
if oldMysqlDb.Username != dbConfig.DbUser || oldMysqlDb.Password != dbConfig.Password {
|
||||||
|
|
Loading…
Add table
Reference in a new issue