1 Star 0 Fork 0

liangchao/gweb

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
conf.go 1.25 KB
一键复制 编辑 原始数据 按行查看 历史
LiangChao(GW00244384) 提交于 2025-07-23 15:29 +08:00 . 2.0
package conf
type Env string
const (
EnvDev Env = "dev" // 开发环境
EnvProd Env = "prod" // 正式环境
EnvTest Env = "test" // 测试环境
)
type Directories struct {
Static string `mapstructure:"static" json:"static" yaml:"static"`
Doc string `mapstructure:"doc" json:"doc" yaml:"doc"`
}
type AppConfig struct {
// Name string `mapstructure:"name" json:"name" yaml:"name"`
Env Env `mapstructure:"env" json:"env" yaml:"env"`
Host string `mapstructure:"host" json:"host" yaml:"host"`
Port int `mapstructure:"port" json:"port" yaml:"port"`
Directories *Directories `mapstructure:"directories" json:"directories" yaml:"directories"`
// System AppConfig `mapstructure:"system" json:"system" yaml:"system"`
DB DbConfig `mapstructure:"db" json:"db" yaml:"db"`
Zap ZapConfig `mapstructure:"zap" json:"zap" yaml:"zap"`
Cors *CorsConfig `mapstructure:"cors" json:"cors" yaml:"cors"`
JWT *JwtConfig `mapstructure:"jwt" json:"jwt" yaml:"jwt"`
Redis *RedisConfig `mapstructure:"redis" json:"redis" yaml:"redis"`
}
func (c *AppConfig) JwtEnabled() bool {
return c.JWT != nil && c.JWT.Enable
}
func (c *AppConfig) CorsEnabled() bool {
return c.Cors != nil && c.Cors.Enable
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/makitdone/gweb.git
git@gitee.com:makitdone/gweb.git
makitdone
gweb
gweb
v2.0.1

搜索帮助