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

update

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