diff --git a/backend/factory/config.go b/backend/factory/config.go index 6bdd2f27a1b5c7b6417439a46566d5eb5c0ed906..796314f76f6a84093046c7497e31dab8a63e0f44 100644 --- a/backend/factory/config.go +++ b/backend/factory/config.go @@ -64,6 +64,7 @@ type Tls struct { } type BillingServer struct { + Enable bool `yaml:"enable" valid:"type(bool), default(true)"` HostIPv4 string `yaml:"hostIPv4,omitempty" valid:"required,host"` Port int `yaml:"port,omitempty" valid:"optional,port"` ListenPort int `yaml:"listenPort,omitempty" valid:"required,port"` diff --git a/backend/webui_service/webui_init.go b/backend/webui_service/webui_init.go index 66aec95b062a27441c38d7b0ae604e793b047403..f08d6851dfddb764b87e5b8c42ca78e317c18c54 100644 --- a/backend/webui_service/webui_init.go +++ b/backend/webui_service/webui_init.go @@ -77,6 +77,7 @@ func (a *WebuiApp) Start(tlsKeyLogPath string) { // get config file info from WebUIConfig mongodb := factory.WebuiConfig.Configuration.Mongodb webServer := factory.WebuiConfig.Configuration.WebServer + billingServer := factory.WebuiConfig.Configuration.BillingServer // Connect to MongoDB if err := mongoapi.SetMongoDB(mongodb.Name, mongodb.Url); err != nil { @@ -135,11 +136,13 @@ func (a *WebuiApp) Start(tlsKeyLogPath string) { self.UpdateNfProfiles() wg := sync.WaitGroup{} - wg.Add(1) - self.BillingServer = billing.OpenServer(&wg) - if self.BillingServer == nil { - logger.InitLog.Errorln("Billing Server open error.") + if billingServer.Enable { + wg.Add(1) + self.BillingServer = billing.OpenServer(&wg) + if self.BillingServer == nil { + logger.InitLog.Errorln("Billing Server open error.") + } } router.NoRoute(ReturnPublic()) diff --git a/config/webuicfg.yaml b/config/webuicfg.yaml index 4496ea00d1ac1b586973baba5f248aea6744fee9..6f55547ccab49c1514dbbe97a586d961681eab3f 100644 --- a/config/webuicfg.yaml +++ b/config/webuicfg.yaml @@ -12,6 +12,7 @@ configuration: ipv4Address: 0.0.0.0 port: 5000 billingServer: + enable: true hostIPv4: 127.0.0.1 listenPort: 2122 port: 2121