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

53 lines
1.2 KiB
Go
Raw Normal View History

2022-11-07 16:19:05 +08:00
package dto
import "github.com/1Panel-dev/1Panel/backend/utils/nginx/components"
type NginxConfig struct {
FilePath string `json:"filePath"`
ContainerName string `json:"containerName"`
Config *components.Config `json:"config"`
OldContent string `json:"oldContent"`
}
type NginxConfigReq struct {
2022-11-08 15:42:31 +08:00
Scope NginxScope `json:"scope"`
Operate NginxOp `json:"operate"`
WebSiteID uint `json:"webSiteId" validate:"required"`
Params interface{} `json:"params"`
2022-11-07 16:19:05 +08:00
}
type NginxScope string
const (
2022-11-08 15:42:31 +08:00
Index NginxScope = "index"
LimitConn NginxScope = "limit-conn"
2022-11-16 10:31:35 +08:00
SSL NginxScope = "ssl"
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
)
var ScopeKeyMap = map[NginxScope][]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-08 15:42:31 +08:00
}
var RepeatKeys = map[string]struct {
}{
"limit_conn": {},
"limit_conn_zone": {},
}
type NginxParam struct {
Name string `json:"name"`
SecondKey string `json:"secondKey"`
IsRepeatKey bool `json:"isRepeatKey"`
Params []string `json:"params"`
2022-11-07 16:19:05 +08:00
}