Skip to content

Commit

Permalink
feat: Support fix node
Browse files Browse the repository at this point in the history
  • Loading branch information
ssongliu committed Dec 24, 2024
1 parent 18321d6 commit 456b682
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
32 changes: 18 additions & 14 deletions core/app/service/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,20 +197,6 @@ func (u *SettingService) UpdatePort(port uint) error {
if err := firewall.UpdatePort(oldPort.Value, fmt.Sprintf("%v", port)); err != nil {
return err
}
masterAddr, err := settingRepo.Get(repo.WithByKey("MasterAddr"))
if err != nil {
global.LOG.Errorf("load master addr from db failed, err: %v", err)
return err
}
if len(masterAddr.Value) != 0 {
oldMasterPort := loadPort(masterAddr.Value)
if len(oldMasterPort) != 0 {
if err := xpack.UpdateMasterAddr(strings.ReplaceAll(masterAddr.Value, oldMasterPort, fmt.Sprintf("%v", port))); err != nil {
global.LOG.Errorf("update master addr from db failed, err: %v", err)
return err
}
}
}

if err := settingRepo.Update("ServerPort", strconv.Itoa(int(port))); err != nil {
return err
Expand All @@ -222,6 +208,23 @@ func (u *SettingService) UpdatePort(port uint) error {
global.LOG.Errorf("restart system port failed, err: %v", err)
}
}()

masterAddr, err := settingRepo.Get(repo.WithByKey("MasterAddr"))
if err != nil {
global.LOG.Errorf("load master addr from db failed, err: %v", err)
return
}
if len(masterAddr.Value) != 0 {
oldMasterPort := loadPort(masterAddr.Value)
if len(oldMasterPort) != 0 {
newMasterAddr := strings.ReplaceAll(masterAddr.Value, oldMasterPort, fmt.Sprintf("%v", port))
_ = settingRepo.Update("MasterAddr", newMasterAddr)
if err := xpack.UpdateMasterAddr(newMasterAddr); err != nil {
global.LOG.Errorf("update master addr from db failed, err: %v", err)
return
}
}
}
}()
return nil
}
Expand Down Expand Up @@ -306,6 +309,7 @@ func (u *SettingService) UpdateSSL(c *gin.Context, req dto.SSLUpdate) error {
} else {
addrItem = strings.ReplaceAll(addrItem, "http://", "https://")
}
_ = settingRepo.Update("MasterAddr", addrItem)
if err := xpack.UpdateMasterAddr(addrItem); err != nil {
global.LOG.Errorf("update master addr from db failed, err: %v", err)
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const message = {
helpDoc: 'Help Document',
bind: 'Bind',
unbind: 'Unbind',
fix: 'Fix',
},
search: {
timeStart: 'Time start',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/tw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const message = {
helpDoc: '幫助文档',
bind: '綁',
unbind: '解除綁定',
fix: '修',
},
search: {
timeStart: '開始時間',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const message = {
helpDoc: '帮助文档',
bind: '绑',
unbind: '解',
fix: '修',
},
search: {
timeStart: '开始时间',
Expand Down

0 comments on commit 456b682

Please sign in to comment.