2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 11:27:17 +08:00

feat: 将面板配置固定保存

This commit is contained in:
耗子
2024-10-12 18:11:34 +08:00
parent 6ec5ebb18d
commit 3c1c4e92b9
9 changed files with 31 additions and 81 deletions

View File

@@ -210,7 +210,7 @@ func (s *CliService) UserPassword(ctx context.Context, cmd *cli.Command) error {
func (s *CliService) HTTPSOn(ctx context.Context, cmd *cli.Command) error {
config := new(types.PanelConfig)
cm := yaml.CommentMap{}
raw, err := io.Read(filepath.Join(app.Root, "panel/config/config.yml"))
raw, err := io.Read("/usr/local/etc/panel/config.yml")
if err != nil {
return err
}
@@ -225,7 +225,7 @@ func (s *CliService) HTTPSOn(ctx context.Context, cmd *cli.Command) error {
return err
}
if err = io.Write(filepath.Join(app.Root, "panel/config/config.yml"), string(encoded), 0700); err != nil {
if err = io.Write("/usr/local/etc/panel/config.yml", string(encoded), 0700); err != nil {
return err
}
@@ -235,7 +235,7 @@ func (s *CliService) HTTPSOn(ctx context.Context, cmd *cli.Command) error {
func (s *CliService) HTTPSOff(ctx context.Context, cmd *cli.Command) error {
config := new(types.PanelConfig)
cm := yaml.CommentMap{}
raw, err := io.Read(filepath.Join(app.Root, "panel/config/config.yml"))
raw, err := io.Read("/usr/local/etc/panel/config.yml")
if err != nil {
return err
}
@@ -250,7 +250,7 @@ func (s *CliService) HTTPSOff(ctx context.Context, cmd *cli.Command) error {
return err
}
if err = io.Write(filepath.Join(app.Root, "panel/config/config.yml"), string(encoded), 0700); err != nil {
if err = io.Write("/usr/local/etc/panel/config.yml", string(encoded), 0700); err != nil {
return err
}
@@ -260,7 +260,7 @@ func (s *CliService) HTTPSOff(ctx context.Context, cmd *cli.Command) error {
func (s *CliService) EntranceOn(ctx context.Context, cmd *cli.Command) error {
config := new(types.PanelConfig)
cm := yaml.CommentMap{}
raw, err := io.Read(filepath.Join(app.Root, "panel/config/config.yml"))
raw, err := io.Read("/usr/local/etc/panel/config.yml")
if err != nil {
return err
}
@@ -275,7 +275,7 @@ func (s *CliService) EntranceOn(ctx context.Context, cmd *cli.Command) error {
return err
}
if err = io.Write(filepath.Join(app.Root, "panel/config/config.yml"), string(encoded), 0700); err != nil {
if err = io.Write("/usr/local/etc/panel/config.yml", string(encoded), 0700); err != nil {
return err
}
@@ -285,7 +285,7 @@ func (s *CliService) EntranceOn(ctx context.Context, cmd *cli.Command) error {
func (s *CliService) EntranceOff(ctx context.Context, cmd *cli.Command) error {
config := new(types.PanelConfig)
cm := yaml.CommentMap{}
raw, err := io.Read(filepath.Join(app.Root, "panel/config/config.yml"))
raw, err := io.Read("/usr/local/etc/panel/config.yml")
if err != nil {
return err
}
@@ -300,7 +300,7 @@ func (s *CliService) EntranceOff(ctx context.Context, cmd *cli.Command) error {
return err
}
if err = io.Write(filepath.Join(app.Root, "panel/config/config.yml"), string(encoded), 0700); err != nil {
if err = io.Write("/usr/local/etc/panel/config.yml", string(encoded), 0700); err != nil {
return err
}
@@ -315,7 +315,7 @@ func (s *CliService) Port(ctx context.Context, cmd *cli.Command) error {
config := new(types.PanelConfig)
cm := yaml.CommentMap{}
raw, err := io.Read(filepath.Join(app.Root, "panel/config/config.yml"))
raw, err := io.Read("/usr/local/etc/panel/config.yml")
if err != nil {
return err
}
@@ -330,7 +330,7 @@ func (s *CliService) Port(ctx context.Context, cmd *cli.Command) error {
return err
}
if err = io.Write(filepath.Join(app.Root, "panel/config/config.yml"), string(encoded), 0700); err != nil {
if err = io.Write("/usr/local/etc/panel/config.yml", string(encoded), 0700); err != nil {
return err
}
@@ -515,7 +515,7 @@ func (s *CliService) Init(ctx context.Context, cmd *cli.Command) error {
config := new(types.PanelConfig)
cm := yaml.CommentMap{}
raw, err := io.Read(filepath.Join(app.Root, "panel/config/config.yml"))
raw, err := io.Read("/usr/local/etc/panel/config.yml")
if err != nil {
return err
}
@@ -530,7 +530,7 @@ func (s *CliService) Init(ctx context.Context, cmd *cli.Command) error {
if err != nil {
return err
}
if err = io.Write(filepath.Join(app.Root, "panel/config/config.yml"), string(encoded), 0700); err != nil {
if err = io.Write("/usr/local/etc/panel/config.yml", string(encoded), 0700); err != nil {
return err
}