refactor all service dependency injection
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user