Documentation
¶
Index ¶
Constants ¶
View Source
const ( DEV = "dev" PROD = "prod" TEST = "test" )
View Source
const Version = "v1.0.0"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Environment string `mapstructure:"environment"` // 环境 dev | test | prod
Listen string `mapstructure:"listen"`
ContextPath string `mapstructure:"contextPath"`
Log LogConfig `mapstructure:"log"`
EncryptKey string `mapstructure:"encryptKey"` // 为了某些数据的安全考虑,使用的对称加密的密钥,16 bytes 或 24 bytes 或 32 bytes
Cookie CookieConfig `mapstructure:"cookie"`
TrustedProxies string `mapstructure:"trustedProxies"`
Pprof Pprof `mapstructure:"pprof"` // pprof性能分析工具,只对开发人员有用
Mysql MysqlConfig `mapstructure:"mysql"`
Redis RedisConfig `mapstructure:"redis"` // 该配置项暂时没用到,可忽略
Mongo MongoConfig `mapstructure:"mongo"` // 该配置项暂时没用到,可忽略
Email EmailConfig `mapstructure:"email"`
RabbitMQ rabbitmq.Config `mapstructure:"rabbitmq"` // 该配置项没用到,可忽略
Grpc GrpcConfig `mapstructure:"grpc"`
WorkDir string `mapstructure:"workDir"` // 指定工作目录,路径分隔符必须是"/"
ScriptExecuteTimeout int32 `mapstructure:"scriptExecuteTimeout"` // 执行script脚本时的超时时间(单位:秒),超过该时间,如果脚本还没执行完,ssh连接将自动断开
}
func (*Config) GetAppPkgPath ¶ added in v1.0.0
type CookieConfig ¶
type CookieConfig struct {
AuthenticationKey string `mapstructure:"authenticationKey"` // 32 bytes 或 64 bytes
SecretKey string `mapstructure:"secretKey"` // 16 bytes 或 24 bytes 或 32 bytes
Path string `mapstructure:"path"`
MaxAge int `mapstructure:"maxAge"`
Secure bool `mapstructure:"secure"`
HttpOnly bool `mapstructure:"httpOnly"`
}
type EmailConfig ¶
type EmailConfig struct {
email.MailConfig `mapstructure:"mc"`
SystemName string `mapstructure:"systemName"` // 系统名称,发送邮件时会使用
AccessUrl string `mapstructure:"accessUrl"` // 系统访问的url,发送邮件时会使用
}
type FileSource ¶ added in v1.0.0
type FileSource struct {
FilePath string
}
func (*FileSource) Close ¶ added in v1.0.0
func (s *FileSource) Close() error
func (*FileSource) GetConfig ¶ added in v1.0.0
func (s *FileSource) GetConfig() (*Config, error)
type GrpcConfig ¶
type LogConfig ¶
type LogConfig struct {
Level string `mapstructure:"level"` // 日志级别 debug | info | warning | error,全局有效
StackTrace bool `mapstructure:"stackTrace"` // 是否打印错误堆栈信息,dev环境始终都会向stderr打印错误堆栈,不管该选项开启还是关闭
LoginLog bool `mapstructure:"loginLog"` // 是否记录登录日志
OpLog bool `mapstructure:"opLog"` // 是否记录操作日志
ExceptionLog bool `mapstructure:"exceptionLog"` // 是否记录异常日志
}
type Manager ¶ added in v1.0.0
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) CloseSource ¶ added in v1.0.0
func (m *Manager) CloseSource()
type MongoConfig ¶
type MysqlConfig ¶
type MysqlConfig struct {
Host string `mapstructure:"host"`
Port int32 `mapstructure:"port"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
Database string `mapstructure:"database"`
ConnPool struct {
MaxOpenConns int `mapstructure:"maxOpenConns"`
MaxIdleConns int `mapstructure:"maxIdleConns"`
ConnMaxLifetime int `mapstructure:"connMaxLifetime"` // 单位:秒
ConnMaxIdleTime int `mapstructure:"connMaxIdleTime"` // 单位:秒
} `mapstructure:"connPool"`
ShowSql bool `mapstructure:"showSql"`
AutoMigrate bool `mapstructure:"autoMigrate"`
}
type NacosSource ¶ added in v1.0.0
func (*NacosSource) Close ¶ added in v1.0.0
func (s *NacosSource) Close() error
func (*NacosSource) GetConfig ¶ added in v1.0.0
func (s *NacosSource) GetConfig() (*Config, error)
type RedisConfig ¶
Click to show internal directories.
Click to hide internal directories.