Skip to content

Commit

Permalink
feat: 重启核心后重新读取配置信息
Browse files Browse the repository at this point in the history
  • Loading branch information
junlongzzz committed Sep 20, 2024
1 parent c7fb8d0 commit 7f83ffd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var (
coreDir string
coreName string
corePath string
coreConfig CoreConfig
coreConfig *CoreConfig

mutex sync.Mutex // 互斥锁
)
Expand Down Expand Up @@ -48,7 +48,8 @@ func loadCoreConfig() {
fatal("Error reading config.yaml:", err)
}

if err := yaml.Unmarshal(bytes, &coreConfig); err != nil {
coreConfig = &CoreConfig{}
if err := yaml.Unmarshal(bytes, coreConfig); err != nil {
fatal("Error parsing config.yaml:", err)
}

Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ func onReady() {
restartCoreItem.Click(func() {
if !restartCore() {
MessageBox(AppName, "Failed to restart core", windows.MB_OK)
} else {
// 重新加载核心配置
loadCoreConfig()
// 重新设置代理
setCoreProxy()
}
})

Expand Down

0 comments on commit 7f83ffd

Please sign in to comment.