1Panel/backend/app/dto/nginx.go

81 lines
1.9 KiB
Go
Raw Normal View History

2022-11-07 16:19:05 +08:00
package dto
2022-12-01 00:41:50 +08:00
import (
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/utils/nginx/components"
)
type NginxFull struct {
Install model.AppInstall
2022-12-13 17:20:13 +08:00
Website model.Website
2022-12-01 00:41:50 +08:00
ConfigDir string
ConfigFile string
SiteDir string
Dir string
RootConfig NginxConfig
SiteConfig NginxConfig
}
2022-11-07 16:19:05 +08:00
type NginxConfig struct {
2022-12-01 00:41:50 +08:00
FilePath string `json:"filePath"`
Config *components.Config `json:"config"`
OldContent string `json:"oldContent"`
2022-11-07 16:19:05 +08:00
}
type NginxConfigReq struct {
2022-11-24 10:28:39 +08:00
Scope NginxKey `json:"scope"`
2022-11-08 15:42:31 +08:00
Operate NginxOp `json:"operate"`
2022-12-13 17:20:13 +08:00
WebsiteID uint `json:"webSiteId"`
2022-11-08 15:42:31 +08:00
Params interface{} `json:"params"`
2022-11-07 16:19:05 +08:00
}
2022-11-24 10:28:39 +08:00
type NginxScopeReq struct {
Scope NginxKey `json:"scope"`
}
2022-11-24 16:06:18 +08:00
type NginxStatus struct {
Active string `json:"active"`
Accepts string `json:"accepts"`
Handled string `json:"handled"`
Requests string `json:"requests"`
Reading string `json:"reading"`
Writing string `json:"writing"`
Waiting string `json:"waiting"`
}
2022-11-24 10:28:39 +08:00
type NginxKey string
2022-11-07 16:19:05 +08:00
const (
2022-11-24 10:28:39 +08:00
Index NginxKey = "index"
LimitConn NginxKey = "limit-conn"
SSL NginxKey = "ssl"
HttpPer NginxKey = "http-per"
2022-11-08 15:42:31 +08:00
)
type NginxOp string
const (
ConfigNew NginxOp = "add"
ConfigUpdate NginxOp = "update"
ConfigDel NginxOp = "delete"
2022-11-07 16:19:05 +08:00
)
2022-11-24 10:28:39 +08:00
var ScopeKeyMap = map[NginxKey][]string{
2022-11-08 15:42:31 +08:00
Index: {"index"},
LimitConn: {"limit_conn", "limit_rate", "limit_conn_zone"},
2022-11-16 10:31:35 +08:00
SSL: {"ssl_certificate", "ssl_certificate_key"},
2022-11-24 10:28:39 +08:00
HttpPer: {"server_names_hash_bucket_size", "client_header_buffer_size", "client_max_body_size", "keepalive_timeout", "gzip", "gzip_min_length", "gzip_comp_level"},
2022-11-08 15:42:31 +08:00
}
2022-12-01 00:41:50 +08:00
var StaticFileKeyMap = map[NginxKey]struct {
2022-11-08 15:42:31 +08:00
}{
2022-12-01 00:41:50 +08:00
SSL: {},
LimitConn: {},
2022-11-08 15:42:31 +08:00
}
type NginxParam struct {
2022-12-01 00:41:50 +08:00
UpdateScope string `json:"scope"`
Name string `json:"name"`
Params []string `json:"params"`
2022-11-07 16:19:05 +08:00
}