feat: 添加了 imager 工具 package
refactor: 将 images 的获取分散到各个组件里面
This commit is contained in:
@@ -16,32 +16,21 @@ type yosguardOpt struct{}
|
||||
|
||||
func (m *maker) Yosguard(ctx context.Context, opts ...YosguardOpt) error {
|
||||
const (
|
||||
configTemplate = `
|
||||
Web:
|
||||
# default listen in docker0
|
||||
Host: 172.17.0.1
|
||||
Port: 7788
|
||||
|
||||
UUIDFilePath: /etc/yosguard/uuid
|
||||
|
||||
# 心跳间隔: 单位秒,默认为5
|
||||
HeartbeatDuration: 5
|
||||
|
||||
# 控制器 yosguard 地址
|
||||
_config = `
|
||||
AsController: true
|
||||
AsGateway: false
|
||||
ControllerServer:
|
||||
Host: dasheng.zhsftech.debug
|
||||
Port: 443
|
||||
|
||||
# True: 作为控制器运行; False: 不作为控制器运行
|
||||
AsController: true
|
||||
|
||||
# True: 作为网关运行; False: 不作为网关运行
|
||||
AsGateway: false
|
||||
|
||||
Port: 443
|
||||
Database:
|
||||
SQLite:
|
||||
DBPath: "/etc/yosguard/db/yosguard.db"
|
||||
SQLPath: "/etc/yosguard/db/create.sql"`
|
||||
DBPath: /etc/yosguard/db/yosguard.db
|
||||
HeartbeatDuration: 5
|
||||
UUIDFilePath: /etc/yosguard/uuid
|
||||
Web:
|
||||
Host: __ip__
|
||||
Port: 7788
|
||||
`
|
||||
|
||||
systemdService = `
|
||||
[Unit]
|
||||
@@ -86,12 +75,12 @@ WantedBy=multi-user.target`
|
||||
}
|
||||
logger.Debug("✅ maker.Yosguard: 下载 yosguard 成功, url = %s", binURL)
|
||||
|
||||
logger.Debug("☑️ maker.Yosguard: 写入 config_template.yml 文件..., dest = %s", filepath.Join(location, "config_template.yml"))
|
||||
if err := os.WriteFile(filepath.Join(location, "config_template.yml"), []byte(configTemplate), 0644); err != nil {
|
||||
logger.Debug("❌ maker.Yosguard: 写入 config_template.yml 失败, dest = %s, err = %v", filepath.Join(location, "config_template.yml"), err)
|
||||
logger.Debug("☑️ maker.Yosguard: 写入 config.yml 文件..., dest = %s", filepath.Join(location, "config.yml"))
|
||||
if err := os.WriteFile(filepath.Join(location, "config.yml"), []byte(_config), 0644); err != nil {
|
||||
logger.Debug("❌ maker.Yosguard: 写入 config.yml 失败, dest = %s, err = %v", filepath.Join(location, "config.yml"), err)
|
||||
return err
|
||||
}
|
||||
logger.Debug("✅ maker.Yosguard: 写入 config_template.yml 文件成功, dest = %s", filepath.Join(location, "config_template.yml"))
|
||||
logger.Debug("✅ maker.Yosguard: 写入 config.yml 文件成功, dest = %s", filepath.Join(location, "config.yml"))
|
||||
|
||||
logger.Debug("☑️ maker.Yosguard: 写入 create.sql 文件..., dest = %s", filepath.Join(location, "create.sql"))
|
||||
if err := os.WriteFile(filepath.Join(location, "create.sql"), resource.SQLYosguard, 0644); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user