(website model.Website, force bool)
| 559 | } |
| 560 | |
| 561 | func delNginxConfig(website model.Website, force bool) error { |
| 562 | fileOp := files.NewFileOp() |
| 563 | var ( |
| 564 | configPath string |
| 565 | ) |
| 566 | if website.Type == constant.Stream { |
| 567 | configPath = GetSitePath(website, StreamConf) |
| 568 | |
| 569 | } else { |
| 570 | configPath = GetSitePath(website, SiteConf) |
| 571 | } |
| 572 | if fileOp.Stat(configPath) { |
| 573 | if err := fileOp.DeleteFile(configPath); err != nil { |
| 574 | return err |
| 575 | } |
| 576 | } |
| 577 | sitePath := GetSiteDir(website.Alias) |
| 578 | if fileOp.Stat(sitePath) { |
| 579 | xpack.MultiNodeProvider.RemoveTamper(website.Alias) |
| 580 | _ = fileOp.DeleteDir(sitePath) |
| 581 | } |
| 582 | |
| 583 | nginxApp, err := appRepo.GetFirst(appRepo.WithKey(constant.AppOpenresty)) |
| 584 | if err != nil { |
| 585 | return err |
| 586 | } |
| 587 | nginxInstall, err := appInstallRepo.GetFirst(appInstallRepo.WithAppId(nginxApp.ID)) |
| 588 | if err != nil { |
| 589 | if errors.Is(err, gorm.ErrRecordNotFound) { |
| 590 | return nil |
| 591 | } |
| 592 | return err |
| 593 | } |
| 594 | if err := opNginx(nginxInstall.ContainerName, constant.NginxReload); err != nil { |
| 595 | if force { |
| 596 | return nil |
| 597 | } |
| 598 | return err |
| 599 | } |
| 600 | return nil |
| 601 | } |
| 602 | |
| 603 | func delWafConfig(website model.Website, force bool) error { |
| 604 | nginxInstall, err := getAppInstallByKey(constant.AppOpenresty) |
no test coverage detected