Skip to content
Snippets Groups Projects
Commit 9471dba5 authored by newb1er's avatar newb1er
Browse files

feat(config): billing server feature toggle

parent 3c7fdc45
No related branches found
No related tags found
No related merge requests found
......@@ -64,6 +64,7 @@ type Tls struct {
}
type BillingServer struct {
Enabled bool `yaml:"enabled" 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"`
......
......@@ -73,6 +73,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 {
......@@ -108,11 +109,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.Enabled {
wg.Add(1)
self.BillingServer = billing.OpenServer(&wg)
if self.BillingServer == nil {
logger.InitLog.Errorln("Billing Server open error.")
}
}
router.NoRoute(ReturnPublic())
......
......@@ -12,6 +12,7 @@ configuration:
ipv4Address: 0.0.0.0
port: 5000
billingServer:
enable: true
hostIPv4: 127.0.0.1
listenPort: 2122
port: 2121
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment