mirror of https://github.com/1Panel-dev/1Panel
fix: 解决数据库文件不存在时启用失败的问题 (#1544)
parent
006c27fee5
commit
35334c1650
|
@ -17,11 +17,11 @@ func Init() {
|
|||
global.LOG.Errorf("load service port from setting failed, err: %v", err)
|
||||
}
|
||||
global.CONF.System.Port = portSetting.Value
|
||||
enptrySetting, err := settingRepo.Get(settingRepo.WithByKey("EncryptKey"))
|
||||
encryptSetting, err := settingRepo.Get(settingRepo.WithByKey("EncryptKey"))
|
||||
if err != nil {
|
||||
global.LOG.Errorf("load service encrypt key from setting failed, err: %v", err)
|
||||
}
|
||||
global.CONF.System.EncryptKey = enptrySetting.Value
|
||||
global.CONF.System.EncryptKey = encryptSetting.Value
|
||||
sslSetting, err := settingRepo.Get(settingRepo.WithByKey("SSL"))
|
||||
if err != nil {
|
||||
global.LOG.Errorf("load service ssl from setting failed, err: %v", err)
|
||||
|
|
|
@ -441,6 +441,12 @@ var EncryptHostPassword = &gormigrate.Migration{
|
|||
return err
|
||||
}
|
||||
|
||||
var encryptSetting model.Setting
|
||||
if err := tx.Where("key = ?", "EncryptKey").Find(&encryptSetting).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
global.CONF.System.EncryptKey = encryptSetting.Value
|
||||
|
||||
for _, host := range hosts {
|
||||
if len(host.Password) != 0 {
|
||||
pass, err := encrypt.StringEncrypt(host.Password)
|
||||
|
|
|
@ -34,7 +34,6 @@ func Start() {
|
|||
log.Init()
|
||||
app.Init()
|
||||
db.Init()
|
||||
hook.Init()
|
||||
migration.Init()
|
||||
validator.Init()
|
||||
gob.Register(psession.SessionUser{})
|
||||
|
@ -43,6 +42,7 @@ func Start() {
|
|||
gin.SetMode("debug")
|
||||
cron.Run()
|
||||
business.Init()
|
||||
hook.Init()
|
||||
|
||||
rootRouter := router.Routers()
|
||||
address := fmt.Sprintf(":%s", global.CONF.System.Port)
|
||||
|
|
|
@ -25,11 +25,11 @@ var userinfoCmd = &cobra.Command{
|
|||
port := getSettingByKey(db, "ServerPort")
|
||||
ssl := getSettingByKey(db, "SSL")
|
||||
entrance := getSettingByKey(db, "SecurityEntrance")
|
||||
enptrySetting := getSettingByKey(db, "EncryptKey")
|
||||
encryptSetting := getSettingByKey(db, "EncryptKey")
|
||||
|
||||
p := ""
|
||||
if len(enptrySetting) == 16 {
|
||||
global.CONF.System.EncryptKey = enptrySetting
|
||||
if len(encryptSetting) == 16 {
|
||||
global.CONF.System.EncryptKey = encryptSetting
|
||||
p, _ = encrypt.StringDecrypt(password)
|
||||
} else {
|
||||
p = password
|
||||
|
|
Loading…
Reference in New Issue