Files
EdgeCommon/pkg/serverconfigs/http_root_config.go

28 lines
984 B
Go
Raw Normal View History

2020-09-26 11:21:38 +08:00
package serverconfigs
2020-09-26 19:54:20 +08:00
import "github.com/TeaOSLab/EdgeCommon/pkg/configutils"
2020-09-26 11:21:38 +08:00
// Web文档目录配置
type HTTPRootConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否优先
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Dir string `yaml:"dir" json:"dir"` // 目录
Indexes []string `yaml:"indexes" json:"indexes"` // 默认首页文件
StripPrefix string `yaml:"stripPrefix" json:"stripPrefix"` // 去除URL前缀
2020-09-26 11:21:38 +08:00
DecodePath bool `yaml:"decodePath" json:"decodePath"` // 是否对请求路径进行解码
IsBreak bool `yaml:"isBreak" json:"isBreak"` // 找不到文件的情况下是否终止
2020-09-26 19:54:20 +08:00
hasVariables bool
2020-09-26 11:21:38 +08:00
}
// 初始化
2020-09-26 19:54:20 +08:00
func (this *HTTPRootConfig) Init() error {
this.hasVariables = configutils.HasVariables(this.Dir)
2020-09-26 11:21:38 +08:00
return nil
}
2020-09-26 19:54:20 +08:00
// 判断是否有变量
func (this *HTTPRootConfig) HasVariables() bool {
return this.hasVariables
}