Skip to content
Snippets Groups Projects
Unverified Commit f2ed194a authored by Ian Chen's avatar Ian Chen Committed by GitHub
Browse files

Merge pull request #79 from yccodr/billing-disable

Disable Billing Server If Needed
parents c5938bf9 f47d82ef
Branches
Tags
No related merge requests found
...@@ -64,6 +64,7 @@ type Tls struct { ...@@ -64,6 +64,7 @@ type Tls struct {
} }
type BillingServer struct { type BillingServer struct {
Enable bool `yaml:"enable" valid:"type(bool), default(true)"`
HostIPv4 string `yaml:"hostIPv4,omitempty" valid:"required,host"` HostIPv4 string `yaml:"hostIPv4,omitempty" valid:"required,host"`
Port int `yaml:"port,omitempty" valid:"optional,port"` Port int `yaml:"port,omitempty" valid:"optional,port"`
ListenPort int `yaml:"listenPort,omitempty" valid:"required,port"` ListenPort int `yaml:"listenPort,omitempty" valid:"required,port"`
......
...@@ -77,6 +77,7 @@ func (a *WebuiApp) Start(tlsKeyLogPath string) { ...@@ -77,6 +77,7 @@ func (a *WebuiApp) Start(tlsKeyLogPath string) {
// get config file info from WebUIConfig // get config file info from WebUIConfig
mongodb := factory.WebuiConfig.Configuration.Mongodb mongodb := factory.WebuiConfig.Configuration.Mongodb
webServer := factory.WebuiConfig.Configuration.WebServer webServer := factory.WebuiConfig.Configuration.WebServer
billingServer := factory.WebuiConfig.Configuration.BillingServer
// Connect to MongoDB // Connect to MongoDB
if err := mongoapi.SetMongoDB(mongodb.Name, mongodb.Url); err != nil { if err := mongoapi.SetMongoDB(mongodb.Name, mongodb.Url); err != nil {
...@@ -135,12 +136,14 @@ func (a *WebuiApp) Start(tlsKeyLogPath string) { ...@@ -135,12 +136,14 @@ func (a *WebuiApp) Start(tlsKeyLogPath string) {
self.UpdateNfProfiles() self.UpdateNfProfiles()
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
wg.Add(1)
if billingServer.Enable {
wg.Add(1)
self.BillingServer = billing.OpenServer(&wg) self.BillingServer = billing.OpenServer(&wg)
if self.BillingServer == nil { if self.BillingServer == nil {
logger.InitLog.Errorln("Billing Server open error.") logger.InitLog.Errorln("Billing Server open error.")
} }
}
router.NoRoute(ReturnPublic()) router.NoRoute(ReturnPublic())
......
...@@ -12,6 +12,7 @@ configuration: ...@@ -12,6 +12,7 @@ configuration:
ipv4Address: 0.0.0.0 ipv4Address: 0.0.0.0
port: 5000 port: 5000
billingServer: billingServer:
enable: true
hostIPv4: 127.0.0.1 hostIPv4: 127.0.0.1
listenPort: 2122 listenPort: 2122
port: 2121 port: 2121
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment