Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xpkg
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
屠思豪
xpkg
Commits
4ec77d7e
提交
4ec77d7e
authored
9月 05, 2025
作者:
mooncake9527
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
4bbc8209
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
157 行增加
和
159 行删除
+157
-159
config.go
config/config.go
+140
-142
nacos.go
onacos/nacos.go
+17
-17
没有找到文件。
config/config.go
浏览文件 @
4ec77d7e
...
@@ -88,28 +88,27 @@ func IsProd() bool {
...
@@ -88,28 +88,27 @@ 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:"-"`
}
}
...
@@ -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"
`
}
}
onacos/nacos.go
浏览文件 @
4ec77d7e
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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论