mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 22:07:16 +08:00
feat: 优化配置加载
This commit is contained in:
@@ -182,7 +182,7 @@ func (r *appRepo) Install(channel, slug string) error {
|
||||
task := new(biz.Task)
|
||||
task.Name = "安装应用 " + item.Name
|
||||
task.Status = biz.TaskStatusWaiting
|
||||
task.Shell = fmt.Sprintf(`curl -s "%s" | bash -s -- "%s" "%s" >> /tmp/%s.log 2>&1`, shellUrl, shellChannel, shellVersion, item.Slug)
|
||||
task.Shell = fmt.Sprintf(`curl -f -s --connect-timeout 10 --retry 3 "%s" | bash -s -- "%s" "%s" >> /tmp/%s.log 2>&1`, shellUrl, shellChannel, shellVersion, item.Slug)
|
||||
task.Log = "/tmp/" + item.Slug + ".log"
|
||||
if err = r.taskRepo.Push(task); err != nil {
|
||||
return err
|
||||
@@ -236,7 +236,7 @@ func (r *appRepo) Uninstall(slug string) error {
|
||||
task := new(biz.Task)
|
||||
task.Name = "卸载应用 " + item.Name
|
||||
task.Status = biz.TaskStatusWaiting
|
||||
task.Shell = fmt.Sprintf(`curl -s "%s" | bash -s -- "%s" "%s" >> /tmp/%s.log 2>&1`, shellUrl, shellChannel, shellVersion, item.Slug)
|
||||
task.Shell = fmt.Sprintf(`curl -f -s --connect-timeout 10 --retry 3 "%s" | bash -s -- "%s" "%s" >> /tmp/%s.log 2>&1`, shellUrl, shellChannel, shellVersion, item.Slug)
|
||||
task.Log = "/tmp/" + item.Slug + ".log"
|
||||
if err = r.taskRepo.Push(task); err != nil {
|
||||
return err
|
||||
@@ -290,7 +290,7 @@ func (r *appRepo) Update(slug string) error {
|
||||
task := new(biz.Task)
|
||||
task.Name = "更新应用 " + item.Name
|
||||
task.Status = biz.TaskStatusWaiting
|
||||
task.Shell = fmt.Sprintf(`curl -s "%s" | bash -s -- "%s" "%s" >> /tmp/%s.log 2>&1`, shellUrl, shellChannel, shellVersion, item.Slug)
|
||||
task.Shell = fmt.Sprintf(`curl -f -s --connect-timeout 10 --retry 3 "%s" | bash -s -- "%s" "%s" >> /tmp/%s.log 2>&1`, shellUrl, shellChannel, shellVersion, item.Slug)
|
||||
task.Log = "/tmp/" + item.Slug + ".log"
|
||||
if err = r.taskRepo.Push(task); err != nil {
|
||||
return err
|
||||
|
||||
@@ -122,7 +122,7 @@ func (r *settingRepo) UpdatePanelSetting(ctx context.Context, setting *request.P
|
||||
restartFlag := false
|
||||
config := new(types.PanelConfig)
|
||||
cm := yaml.CommentMap{}
|
||||
raw, err := io.Read("config/config.yml")
|
||||
raw, err := io.Read(filepath.Join(app.Root, "panel/config/config.yml"))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -139,7 +139,7 @@ func (r *settingRepo) UpdatePanelSetting(ctx context.Context, setting *request.P
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if err = io.Write("config/config.yml", string(encoded), 0644); err != nil {
|
||||
if err = io.Write(filepath.Join(app.Root, "panel/config/config.yml"), string(encoded), 0644); err != nil {
|
||||
return false, err
|
||||
}
|
||||
if raw != string(encoded) {
|
||||
|
||||
Reference in New Issue
Block a user