提交 4ec77d7e authored 作者: mooncake9527's avatar mooncake9527

update

上级 4bbc8209
......@@ -88,29 +88,28 @@ func IsProd() bool {
type Config struct {
l *sync.RWMutex
App App `yaml:"app"`
Auth Auth `yaml:"auth"`
ConfType string `yaml:"-"`
Local Local `yaml:"-"`
Consul Consul `yaml:"consul"`
Nacos onacos.NacosConfig `yaml:"nacos"`
Database []Database `yaml:"database"`
Etcd Etcd `yaml:"etcd"`
Grpc Grpc `yaml:"grpc"`
GrpcClient []GrpcClient `yaml:"grpcClient"`
HTTP HTTP `yaml:"http"`
Jaeger Jaeger `yaml:"jaeger"`
Logger Logger `yaml:"logger"`
NacosRd NacosRd `yaml:"nacosRd"`
Redis Redis `yaml:"redis"`
CronJobs Cron `yaml:"cron"`
App App `yaml:"app" json:"app"`
Auth Auth `yaml:"auth" json:"auth"`
ConfType string `yaml:"confType" json:"confType"`
Local Local `yaml:"-" json:"local"`
Consul Consul `yaml:"-" json:"consul"`
Nacos onacos.NacosConfig `yaml:"-" json:"nacos"`
Database []Database `yaml:"database" json:"database"`
Etcd Etcd `yaml:"etcd" json:"etcd"`
Grpc Grpc `yaml:"grpc" json:"grpc"`
GrpcClient []GrpcClient `yaml:"grpcClient" json:"grpcClient"`
HTTP HTTP `yaml:"http" json:"http"`
Jaeger Jaeger `yaml:"jaeger" json:"jaeger"`
Logger Logger `yaml:"logger" json:"logger"`
NacosRd NacosRd `yaml:"nacosRd" json:"nacosRd"`
Redis Redis `yaml:"redis" json:"redis"`
CronJobs Cron `yaml:"cron" json:"cron"`
NacosConfClient *NacosClient `yaml:"-" json:"-"`
NacosNamingClient *nacos.NacosNamingClient `yaml:"-" json:"-"`
AliOss alioss.AliOssConfig `yaml:"oss"`
Content []byte `yaml:"-" json:"-"`
AliOss alioss.AliOssConfig `yaml:"oss" json:"oss"`
Content []byte `yaml:"-" json:"-"`
}
func (x *Config) GetContent() []byte {
......@@ -146,97 +145,96 @@ type Local struct {
}
type Auth struct {
Enable bool `yaml:"enable"`
SignKey string `yaml:"signKey"`
Expire time.Duration `yaml:"expire"`
Enable bool `yaml:"enable" json:"enable"`
SignKey string `yaml:"signKey" json:"signKey"`
Expire time.Duration `yaml:"expire" json:"expire"`
}
type Consul struct {
Conf string `yaml:"conf"`
Addr string `yaml:"addr"`
Token string `yaml:"token"`
Conf string `yaml:"conf" json:"conf"`
Addr string `yaml:"addr" json:"addr"`
Token string `yaml:"token" json:"token"`
}
type Etcd struct {
Addrs []string `yaml:"addrs"`
Addrs []string `yaml:"addrs" json:"addrs"`
}
type Jaeger struct {
AgentHost string `yaml:"agentHost"`
AgentPort int `yaml:"agentPort"`
AgentHost string `yaml:"agentHost" json:"agentHost"`
AgentPort int `yaml:"agentPort" json:"agentPort"`
}
type ClientToken struct {
AppID string `yaml:"appID"`
AppKey string `yaml:"appKey"`
Enable bool `yaml:"enable"`
AppID string `yaml:"appID" json:"appID"`
AppKey string `yaml:"appKey" json:"appKey"`
Enable bool `yaml:"enable" json:"enable"`
}
type ClientSecure struct {
CaFile string `yaml:"caFile"`
CertFile string `yaml:"certFile"`
KeyFile string `yaml:"keyFile"`
ServerName string `yaml:"serverName"`
Type string `yaml:"type"`
CaFile string `yaml:"caFile" json:"caFile"`
CertFile string `yaml:"certFile" json:"certFile"`
KeyFile string `yaml:"keyFile" json:"keyFile"`
ServerName string `yaml:"serverName" json:"serverName"`
Type string `yaml:"type" json:"type"`
}
type ServerSecure struct {
CaFile string `yaml:"caFile"`
CertFile string `yaml:"certFile"`
KeyFile string `yaml:"keyFile"`
Type string `yaml:"type"`
CaFile string `yaml:"caFile" json:"caFile"`
CertFile string `yaml:"certFile" json:"certFile"`
KeyFile string `yaml:"keyFile" json:"keyFile"`
Type string `yaml:"type" json:"type"`
}
type EmailConfig struct {
SMTPServer string `yaml:"smtpServer"`
SMTPPort int `yaml:"smtpPort"`
SMTPUsername string `yaml:"smtpUsername"`
SMTPPassword string `yaml:"smtpPassword"`
FromEmail string `yaml:"fromEmail"`
ExpireDuration string `yaml:"expireDuration"`
SMTPServer string `yaml:"smtpServer" json:"smtpServer"`
SMTPPort int `yaml:"smtpPort" json:"smtpPort"`
SMTPUsername string `yaml:"smtpUsername" json:"smtpUsername"`
SMTPPassword string `yaml:"smtpPassword" json:"smtpPassword"`
FromEmail string `yaml:"fromEmail" json:"fromEmail"`
ExpireDuration string `yaml:"expireDuration" json:"expireDuration"`
}
type App struct {
CacheType string `yaml:"cacheType"`
EnableCircuitBreaker bool `yaml:"enableCircuitBreaker"`
EnableHTTPProfile bool `yaml:"enableHTTPProfile"`
EnableLimit bool `yaml:"enableLimit"`
EnableMetrics bool `yaml:"enableMetrics"`
EnableStat bool `yaml:"enableStat"`
EnableTrace bool `yaml:"enableTrace"`
Env string `yaml:"env"`
Host string `yaml:"host"`
Name string `yaml:"name"`
RegistryDiscoveryType string `yaml:"registryDiscoveryType"`
TracingSamplingRate float64 `yaml:"tracingSamplingRate"`
Version string `yaml:"version"`
IPRateLimiter IPRateLimiter `yaml:"ipRateLimiter"`
ConfigSourceType string `yaml:"-"` // local,consul,nacos
ConfPath string `yaml:"-"`
PodName string `yaml:"-"`
WebLog WebLog `yaml:"webLog"`
Email EmailConfig `yaml:"email"`
CacheType string `yaml:"cacheType" json:"cacheType"`
EnableCircuitBreaker bool `yaml:"enableCircuitBreaker" json:"enableCircuitBreaker"`
EnableHTTPProfile bool `yaml:"enableHTTPProfile" json:"enableHTTPProfile"`
EnableLimit bool `yaml:"enableLimit" json:"enableLimit"`
EnableMetrics bool `yaml:"enableMetrics" json:"enableMetrics"`
EnableStat bool `yaml:"enableStat" json:"enableStat"`
EnableTrace bool `yaml:"enableTrace" json:"enableTrace"`
Env string `yaml:"env" json:"env"`
Host string `yaml:"host" json:"host"`
Name string `yaml:"name" json:"name"`
RegistryDiscoveryType string `yaml:"registryDiscoveryType" json:"registryDiscoveryType"`
TracingSamplingRate float64 `yaml:"tracingSamplingRate" json:"tracingSamplingRate"`
Version string `yaml:"version" json:"version"`
IPRateLimiter IPRateLimiter `yaml:"ipRateLimiter" json:"ipRateLimiter"`
ConfPath string `yaml:"-" json:"confPath"`
PodName string `yaml:"-" json:"podName"`
WebLog WebLog `yaml:"webLog" json:"webLog"`
Email EmailConfig `yaml:"email" json:"email"`
}
type WebLog struct {
Enable bool `yaml:"enable"`
IgnorePaths []string `yaml:"ignorePaths"`
Enable bool `yaml:"enable" json:"enable"`
IgnorePaths []string `yaml:"ignorePaths" json:"ignorePaths"`
}
type IPRateLimiter struct {
Enable bool `yaml:"enable"`
Sync bool `yaml:"sync"`
Window string `yaml:"window"`
MaxRequests int `yaml:"maxRequests"`
Store RateLimiterStore `yaml:"store"`
Enable bool `yaml:"enable" json:"enable"`
Sync bool `yaml:"sync" json:"sync"`
Window string `yaml:"window" json:"window"`
MaxRequests int `yaml:"maxRequests" json:"maxRequests"`
Store RateLimiterStore `yaml:"store" json:"store"`
}
type RateLimiterStore struct {
Type string `yaml:"redis"`
Addr string `yaml:"addr"`
Password string `yaml:"password"`
DB int `yaml:"db"`
Type string `yaml:"redis" json:"redis"`
Addr string `yaml:"addr" json:"addr"`
Password string `yaml:"password" json:"password"`
DB int `yaml:"db" json:"db"`
}
func (x IPRateLimiter) Get() (time.Duration, int) {
......@@ -262,114 +260,114 @@ func (x IPRateLimiter) GetStore() (string, string, int) {
}
type GrpcClient struct {
ClientSecure ClientSecure `yaml:"clientSecure"`
ClientToken ClientToken `yaml:"clientToken"`
Host string `yaml:"host"`
Name string `yaml:"name"`
Port int `yaml:"port"`
RegistryDiscoveryType string `yaml:"registryDiscoveryType"`
Timeout int `yaml:"timeout"`
ClientSecure ClientSecure `yaml:"clientSecure" json:"clientSecure"`
ClientToken ClientToken `yaml:"clientToken" json:"clientToken"`
Host string `yaml:"host" json:"host"`
Name string `yaml:"name" json:"name"`
Port int `yaml:"port" json:"port"`
RegistryDiscoveryType string `yaml:"registryDiscoveryType" json:"registryDiscoveryType"`
Timeout int `yaml:"timeout" json:"timeout"`
}
type Sqlite struct {
ConnMaxLifetime int `yaml:"connMaxLifetime"`
DBFile string `yaml:"dbFile"`
EnableLog bool `yaml:"enableLog"`
MaxIdleConns int `yaml:"maxIdleConns"`
MaxOpenConns int `yaml:"maxOpenConns"`
ConnMaxLifetime int `yaml:"connMaxLifetime" json:"connMaxLifetime"`
DBFile string `yaml:"dbFile" json:"dbFile"`
EnableLog bool `yaml:"enableLog" json:"enableLog"`
MaxIdleConns int `yaml:"maxIdleConns" json:"maxIdleConns"`
MaxOpenConns int `yaml:"maxOpenConns" json:"maxOpenConns"`
}
type Mysql struct {
ConnMaxLifetime int `yaml:"connMaxLifetime"`
Dsn string `yaml:"dsn"`
EnableLog bool `yaml:"enableLog"`
MastersDsn []string `yaml:"mastersDsn"`
MaxIdleConns int `yaml:"maxIdleConns"`
MaxOpenConns int `yaml:"maxOpenConns"`
SlavesDsn []string `yaml:"slavesDsn"`
ConnMaxLifetime int `yaml:"connMaxLifetime" json:"connMaxLifetime"`
Dsn string `yaml:"dsn" json:"dsn"`
EnableLog bool `yaml:"enableLog" json:"enableLog"`
MastersDsn []string `yaml:"mastersDsn" json:"mastersDsn"`
MaxIdleConns int `yaml:"maxIdleConns" json:"maxIdleConns"`
MaxOpenConns int `yaml:"maxOpenConns" json:"maxOpenConns"`
SlavesDsn []string `yaml:"slavesDsn" json:"slavesDsn"`
}
type Postgresql struct {
ConnMaxLifetime int `yaml:"connMaxLifetime"`
Dsn string `yaml:"dsn"`
EnableLog bool `yaml:"enableLog"`
MaxIdleConns int `yaml:"maxIdleConns"`
MaxOpenConns int `yaml:"maxOpenConns"`
ConnMaxLifetime int `yaml:"connMaxLifetime" json:"connMaxLifetime"`
Dsn string `yaml:"dsn" json:"dsn"`
EnableLog bool `yaml:"enableLog" json:"enableLog"`
MaxIdleConns int `yaml:"maxIdleConns" json:"maxIdleConns"`
MaxOpenConns int `yaml:"maxOpenConns" json:"maxOpenConns"`
}
type Redis struct {
DialTimeout int `yaml:"dialTimeout"`
Dsn string `yaml:"dsn"`
ReadTimeout int `yaml:"readTimeout"`
WriteTimeout int `yaml:"writeTimeout"`
DialTimeout int `yaml:"dialTimeout" json:"dialTimeout"`
Dsn string `yaml:"dsn" json:"dsn"`
ReadTimeout int `yaml:"readTimeout" json:"readTimeout"`
WriteTimeout int `yaml:"writeTimeout" json:"writeTimeout"`
}
type Database struct {
Name string `yaml:"name"`
Driver string `yaml:"driver"`
Default bool `yaml:"default"`
Mongodb Mongodb `yaml:"mongodb"`
Mysql Mysql `yaml:"mysql"`
Postgresql Mysql `yaml:"postgresql"`
Sqlite Sqlite `yaml:"sqlite"`
Name string `yaml:"name" json:"name"`
Driver string `yaml:"driver" json:"driver"`
Default bool `yaml:"default" json:"default"`
Mongodb Mongodb `yaml:"mongodb" json:"mongodb"`
Mysql Mysql `yaml:"mysql" json:"mysql"`
Postgresql Mysql `yaml:"postgresql" json:"postgresql"`
Sqlite Sqlite `yaml:"sqlite" json:"sqlite"`
}
type Mongodb struct {
Dsn string `yaml:"dsn"`
Dsn string `yaml:"dsn" json:"dsn"`
}
type Grpc struct {
EnableToken bool `yaml:"enableToken"`
HTTPPort int `yaml:"httpPort"`
Port int `yaml:"port"`
ServerSecure ServerSecure `yaml:"serverSecure"`
EnableToken bool `yaml:"enableToken" json:"enableToken"`
HTTPPort int `yaml:"httpPort" json:"httpPort"`
Port int `yaml:"port" json:"port"`
ServerSecure ServerSecure `yaml:"serverSecure" json:"serverSecure"`
}
type Logger struct {
Format string `yaml:"format"`
IsSave bool `yaml:"isSave"`
Level string `yaml:"level"`
LogFileConfig LogFileConfig `yaml:"logFileConfig"`
Format string `yaml:"format" json:"format"`
IsSave bool `yaml:"isSave" json:"isSave"`
Level string `yaml:"level" json:"level"`
LogFileConfig LogFileConfig `yaml:"logFileConfig" json:"logFileConfig"`
}
type LogFileConfig struct {
Filename string `yaml:"filename"`
MaxSize int `yaml:"maxSize"`
MaxBackups int `yaml:"maxBackups"`
MaxAge int `yaml:"maxAge"`
IsCompression bool `yaml:"isCompression"`
Filename string `yaml:"filename" json:"filename"`
MaxSize int `yaml:"maxSize" json:"maxSize"`
MaxBackups int `yaml:"maxBackups" json:"maxBackups"`
MaxAge int `yaml:"maxAge" json:"maxAge"`
IsCompression bool `yaml:"isCompression" json:"isCompression"`
}
type NacosRd struct {
IPAddr string `yaml:"ipAddr"`
NamespaceID string `yaml:"namespaceID"`
Port int `yaml:"port"`
IPAddr string `yaml:"ipAddr" json:"ipAddr"`
NamespaceID string `yaml:"namespaceID" json:"namespaceID"`
Port int `yaml:"port" json:"port"`
}
type HTTP struct {
Port int `yaml:"port"`
Timeout int `yaml:"timeout"`
Port int `yaml:"port" json:"port"`
Timeout int `yaml:"timeout" json:"timeout"`
}
type UpgradeConfig struct {
Limits []UpgradeLimit `yaml:"limits"`
Limits []UpgradeLimit `yaml:"limits" json:"limits"`
}
type UpgradeLimit struct {
MaxCount int64 `mapstructure:"max-count" json:"max-count" yaml:"max-count"`
Duration time.Duration `yaml:"duration"`
Tip string `yaml:"tip"`
Duration time.Duration `yaml:"duration" json:"duration"`
Tip string `yaml:"tip" json:"tip"`
}
type Cron struct {
// Jobs []CronJob`yaml:"jobs"`
Enable bool `yaml:"enable"`
// Jobs []CronJob`yaml:"jobs" json:"jobs"`
Enable bool `yaml:"enable" json:"enable"`
}
type CronJob struct {
Name string `yaml:"name"`
TimeSpec string `yaml:"timeSpec"`
IsRunOnce bool ` yaml:"isRunOnce"` // if the task is only run once
Enable bool `yaml:"enable"`
Args string `yaml:"args"`
Name string `yaml:"name" json:"name"`
TimeSpec string `yaml:"timeSpec" json:"timeSpec"`
IsRunOnce bool ` yaml:"isRunOnce" json:"isRunOnce"` // if the task is only run once
Enable bool `yaml:"enable" json:"enable"`
Args string `yaml:"args" json:"args"`
}
package onacos
type NacosConfig struct {
IPs []string `yaml:"ips"`
Port int `yaml:"port"`
Conf NacosConfConfig `yaml:"conf"`
Rd NacosSvcConfig `yaml:"rd"`
IPs []string `yaml:"ips" json:"ips"`
Port int `yaml:"port" json:"port"`
Conf NacosConfConfig `yaml:"conf" json:"conf"`
Rd NacosSvcConfig `yaml:"rd" json:"rd"`
}
type NacosConfConfig struct {
Namespace string `yaml:"namespace"`
ContextPath string `yaml:"context"`
DataID string `yaml:"dataId"`
Group string `yaml:"group"`
Namespace string `yaml:"namespace" json:"namespace"`
ContextPath string `yaml:"context" json:"context"`
DataID string `yaml:"dataId" json:"dataId"`
Group string `yaml:"group" json:"group"`
}
type NacosSvcConfig struct {
IP string `yaml:"ip"`
Port int `yaml:"port"`
ServiceName string `yaml:"serviceName"`
GroupName string `yaml:"groupName"`
ClusterName string `yaml:"clusterName"`
Weight int `yaml:"weight"`
Enable bool `yaml:"enable"`
Healthy bool `yaml:"healthy"`
Ephemeral bool `yaml:"ephemeral"`
IP string `yaml:"ip" json:"ip"`
Port int `yaml:"port" json:"port"`
ServiceName string `yaml:"serviceName" json:"serviceName"`
GroupName string `yaml:"groupName" json:"groupName"`
ClusterName string `yaml:"clusterName" json:"clusterName"`
Weight int `yaml:"weight" json:"weight"`
Enable bool `yaml:"enable" json:"enable"`
Healthy bool `yaml:"healthy" json:"healthy"`
Ephemeral bool `yaml:"ephemeral" json:"ephemeral"`
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论