🎨同步配置文件改为队列操作(没写完)
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"gitee.ltd/lxh/logger/log"
|
||||
"github.com/spf13/cast"
|
||||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
||||
"os"
|
||||
"wireguard-dashboard/client"
|
||||
"wireguard-dashboard/component"
|
||||
"wireguard-dashboard/constant"
|
||||
@@ -163,9 +164,17 @@ func (s Script) InitServer() error {
|
||||
"Server": serverConfig,
|
||||
}
|
||||
|
||||
var templatePath, outFilePath string
|
||||
if os.Getenv("GIN_MODE") != "release" {
|
||||
templatePath = "E:\\Workspace\\Go\\wireguard-dashboard\\template\\wg.conf"
|
||||
outFilePath = "E:\\Workspace\\Go\\wireguard-dashboard\\wg0.conf"
|
||||
} else {
|
||||
templatePath = "./template/wg.conf"
|
||||
outFilePath = cast.ToString(data["configFilePath"])
|
||||
}
|
||||
|
||||
// 数据库保存完毕,应用配置到配置文件当中
|
||||
err = component.Wireguard().Apply("E:\\Workspace\\Go\\wireguard-dashboard\\template\\wg.conf",
|
||||
"E:\\Workspace\\Go\\wireguard-dashboard\\wg0.conf", execData)
|
||||
err = component.Wireguard().Apply(templatePath, outFilePath, execData)
|
||||
if err != nil {
|
||||
log.Errorf("应用配置文件失败: %v", err.Error())
|
||||
return err
|
||||
|
Reference in New Issue
Block a user