feat:service mod

This commit is contained in:
2025-03-29 15:02:49 +08:00
parent d131495f4f
commit 922cfd6a02
7 changed files with 325 additions and 11 deletions

View File

@@ -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
}

View File

@@ -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