feat:service mod
This commit is contained in:
11
conf/new.go
11
conf/new.go
@@ -59,11 +59,11 @@ func NotNil(values ...string) {
|
||||
}
|
||||
}
|
||||
|
||||
func PrintInfo(port int) {
|
||||
func PrintInfo(ip string, port int) {
|
||||
print.Success("[BSM - %s] Config Check Success.", vars.ServiceKey)
|
||||
print.Info("[BSM - %s] Service Name: %s", vars.ServiceKey, vars.ServiceKey)
|
||||
print.Info("[BSM - %s] Runtime Mode: %s", vars.ServiceKey, env.Runtime.Mode)
|
||||
print.Info("[BSM - %s] Listen Addr: %s:%d", vars.ServiceKey, utils.GetLocationIP(), port)
|
||||
print.Info("[BSM - %s] Listen Addr: %s:%d", vars.ServiceKey, ip, port)
|
||||
}
|
||||
|
||||
func CheckPort(port int) int {
|
||||
@@ -73,3 +73,10 @@ func CheckPort(port int) int {
|
||||
}
|
||||
return port
|
||||
}
|
||||
|
||||
func CheckIP(ip string) string {
|
||||
if ip == "" {
|
||||
return utils.GetLocationIP()
|
||||
}
|
||||
return ip
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package conf
|
||||
|
||||
type Base struct {
|
||||
Service string `yaml:"Service"` // 服务名称
|
||||
Port int `yaml:"Port"` // 服务监听端口,0为自动随机端口
|
||||
Cache string `yaml:"Cache"` // REDIS缓存
|
||||
OnMicroService bool `yaml:"OnMicroService"` // 是否启用微服务
|
||||
SecretKey string `yaml:"SecretKey"` // 服务秘钥
|
||||
Service string `yaml:"Service"` // 服务名称
|
||||
Port int `yaml:"Port"` // 服务监听端口,0为自动随机端口
|
||||
Cache string `yaml:"Cache"` // REDIS缓存
|
||||
SecretKey string `yaml:"SecretKey"` // 服务秘钥
|
||||
BindIP string `yaml:"BindIP"` // 绑定IP
|
||||
}
|
||||
|
||||
type DBConf struct {
|
||||
@@ -13,6 +13,11 @@ type DBConf struct {
|
||||
Source []string `yaml:"Source"` // 数据库连接
|
||||
}
|
||||
|
||||
type MicroServiceConf struct {
|
||||
Enable bool `yaml:"Enable"` // 是否启用微服务
|
||||
Anonymous []string `yaml:"Anonymous"`
|
||||
}
|
||||
|
||||
type ApmConf struct {
|
||||
Name string // APM服务名称
|
||||
Platform string `yaml:"Platform"` // APM平台:apm,skywalking
|
||||
|
||||
Reference in New Issue
Block a user