mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
fix: 解决 redis 页面命令行执行命令提示未认证的问题 (#1858)
This commit is contained in:
parent
20a47afb8c
commit
8c2d3e432d
@ -192,10 +192,19 @@ func (a *AppInstallRepo) LoadBaseInfo(key string, name string) (*RootInfo, error
|
|||||||
if err := json.Unmarshal([]byte(appInstall.Env), &envMap); err != nil {
|
if err := json.Unmarshal([]byte(appInstall.Env), &envMap); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
password, ok := envMap["PANEL_DB_ROOT_PASSWORD"].(string)
|
switch app.Key {
|
||||||
if ok {
|
case "mysql":
|
||||||
info.Password = password
|
password, ok := envMap["PANEL_DB_ROOT_PASSWORD"].(string)
|
||||||
|
if ok {
|
||||||
|
info.Password = password
|
||||||
|
}
|
||||||
|
case "redis":
|
||||||
|
password, ok := envMap["PANEL_REDIS_ROOT_PASSWORD"].(string)
|
||||||
|
if ok {
|
||||||
|
info.Password = password
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
userPassword, ok := envMap["PANEL_DB_USER_PASSWORD"].(string)
|
userPassword, ok := envMap["PANEL_DB_USER_PASSWORD"].(string)
|
||||||
if ok {
|
if ok {
|
||||||
info.UserPassword = userPassword
|
info.UserPassword = userPassword
|
||||||
|
@ -731,7 +731,11 @@ func updateInstallInfoInDB(appKey, appName, param string, isRestart bool, value
|
|||||||
envKey := ""
|
envKey := ""
|
||||||
switch param {
|
switch param {
|
||||||
case "password":
|
case "password":
|
||||||
envKey = "PANEL_DB_ROOT_PASSWORD="
|
if appKey == "mysql" {
|
||||||
|
envKey = "PANEL_DB_ROOT_PASSWORD="
|
||||||
|
} else {
|
||||||
|
envKey = "PANEL_REDIS_ROOT_PASSWORD="
|
||||||
|
}
|
||||||
case "port":
|
case "port":
|
||||||
envKey = "PANEL_APP_PORT_HTTP="
|
envKey = "PANEL_APP_PORT_HTTP="
|
||||||
case "user-password":
|
case "user-password":
|
||||||
@ -760,6 +764,10 @@ func updateInstallInfoInDB(appKey, appName, param string, isRestart bool, value
|
|||||||
if param == "password" {
|
if param == "password" {
|
||||||
oldVal = fmt.Sprintf("\"PANEL_DB_ROOT_PASSWORD\":\"%v\"", appInstall.Password)
|
oldVal = fmt.Sprintf("\"PANEL_DB_ROOT_PASSWORD\":\"%v\"", appInstall.Password)
|
||||||
newVal = fmt.Sprintf("\"PANEL_DB_ROOT_PASSWORD\":\"%v\"", value)
|
newVal = fmt.Sprintf("\"PANEL_DB_ROOT_PASSWORD\":\"%v\"", value)
|
||||||
|
if appKey == "redis" {
|
||||||
|
oldVal = fmt.Sprintf("\"PANEL_REDIS_ROOT_PASSWORD\":\"%v\"", appInstall.Password)
|
||||||
|
newVal = fmt.Sprintf("\"PANEL_REDIS_ROOT_PASSWORD\":\"%v\"", value)
|
||||||
|
}
|
||||||
_ = appInstallRepo.BatchUpdateBy(map[string]interface{}{
|
_ = appInstallRepo.BatchUpdateBy(map[string]interface{}{
|
||||||
"param": strings.ReplaceAll(appInstall.Param, oldVal, newVal),
|
"param": strings.ReplaceAll(appInstall.Param, oldVal, newVal),
|
||||||
"env": strings.ReplaceAll(appInstall.Env, oldVal, newVal),
|
"env": strings.ReplaceAll(appInstall.Env, oldVal, newVal),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user