refactor all service dependency injection

This commit is contained in:
2026-08-10 11:35:48 +08:00
parent 007a7ba38a
commit c883cc52a2
152 changed files with 1030 additions and 223 deletions

View File

@@ -13,8 +13,6 @@ import (
"git.apinb.com/bsm-sdk/core/conf"
)
const ServiceKey = "all"
type SrvConfig struct {
conf.Base `yaml:",inline"`
Databases *conf.DBConf `yaml:"Databases"`
@@ -32,8 +30,8 @@ type SrvConfig struct {
var Spec SrvConfig
func New() {
conf.New(ServiceKey, &Spec)
func New(serviceKey string) {
conf.New(serviceKey, &Spec)
Spec.Port = conf.CheckPort(Spec.Port)
Spec.BindIP = conf.CheckIP(Spec.BindIP)
Spec.Addr = net.JoinHostPort(Spec.BindIP, Spec.Port)

View File

@@ -9,7 +9,7 @@ import (
)
func TestAllDevConfig(t *testing.T) {
data, err := os.ReadFile(filepath.Join("..", "..", "etc", "all_dev.yaml"))
data, err := os.ReadFile(filepath.Join("..", "..", "etc", "default_dev.yaml"))
if err != nil {
t.Fatal(err)
}