refactor: 更新配置文件和代码以优化数据库连接设置
This commit is contained in:
@@ -3,26 +3,26 @@
|
|||||||
# duration: rotation time with xx hours, example: 1/12/24 hours
|
# duration: rotation time with xx hours, example: 1/12/24 hours
|
||||||
# count: rotation count of log, default is 30 rotation
|
# count: rotation count of log, default is 30 rotation
|
||||||
logger:
|
logger:
|
||||||
file: ./log/restagent.log
|
file: ./log/restagent.log
|
||||||
level: trace
|
level: trace
|
||||||
duration: 24
|
duration: 24
|
||||||
count: 2
|
count: 2
|
||||||
|
|
||||||
# pprof: false(default)/true to disable/enable pprof
|
# pprof: false(default)/true to disable/enable pprof
|
||||||
pprof:
|
pprof:
|
||||||
enabled: true
|
enabled: true
|
||||||
addr: :33060
|
addr: :33060
|
||||||
|
|
||||||
# rest agent listen ipv4/v6 and port, support multiple routines
|
# rest agent listen ipv4/v6 and port, support multiple routines
|
||||||
# ip: 0.0.0.0 or ::0, support IPv4/v6
|
# ip: 0.0.0.0 or ::0, support IPv4/v6
|
||||||
# clientAuthType: 0:NoClientCert (default), 1:RequestClientCert, 2:RequireAnyClientCert,
|
# clientAuthType: 0:NoClientCert (default), 1:RequestClientCert, 2:RequireAnyClientCert,
|
||||||
# 3:VerifyClientCertIfGiven, 4:RequireAndVerifyClientCerts
|
# 3:VerifyClientCertIfGiven, 4:RequireAndVerifyClientCerts
|
||||||
rest:
|
rest:
|
||||||
- ipv4: 0.0.0.0
|
- ipv4: 0.0.0.0
|
||||||
ipv6:
|
ipv6:
|
||||||
port: 33030
|
port: 33040
|
||||||
- ipv4: 0.0.0.0
|
- ipv4: 0.0.0.0
|
||||||
ipv6:
|
ipv6:
|
||||||
port: 33443
|
port: 33443
|
||||||
schema: https
|
schema: https
|
||||||
clientAuthType: 0
|
clientAuthType: 0
|
||||||
@@ -33,25 +33,35 @@ rest:
|
|||||||
webServer:
|
webServer:
|
||||||
enabled: true
|
enabled: true
|
||||||
rootDir: d:/omc.git/fe.ems.vue3/dist # front-end build dist directory
|
rootDir: d:/omc.git/fe.ems.vue3/dist # front-end build dist directory
|
||||||
listen:
|
listen:
|
||||||
- addr: :80
|
- addr: :80
|
||||||
schema: http
|
schema: http
|
||||||
- addr: :443
|
- addr: :443
|
||||||
schema: https
|
schema: https
|
||||||
clientAuthType: 0
|
clientAuthType: 0
|
||||||
caFile: ./etc/certs/omc-ca.crt
|
caFile: ./etc/certs/omc-ca.crt
|
||||||
certFile: ./etc/certs/omc-server.crt
|
certFile: ./etc/certs/omc-web.crt
|
||||||
keyFile: ./etc/certs/omc-server.key
|
keyFile: ./etc/certs/omc-web.key
|
||||||
|
|
||||||
|
# data sources
|
||||||
database:
|
database:
|
||||||
type: mysql
|
dataSource:
|
||||||
user: root
|
# Default database instance
|
||||||
password: 1000omc@kp!
|
default:
|
||||||
host: 127.0.0.1
|
type: "mysql"
|
||||||
port: 33066
|
host: "127.0.0.1"
|
||||||
name: omc_db
|
port: 33066
|
||||||
connParam: charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&interpolateParams=True
|
username: "root"
|
||||||
backup: ./database
|
password: "1000omc@kp!"
|
||||||
|
database: "omc_db"
|
||||||
|
logging: true
|
||||||
|
# Built-in lightweight database
|
||||||
|
lite:
|
||||||
|
type: "sqlite"
|
||||||
|
database: "../database/omc_db.sqlite"
|
||||||
|
logging: true
|
||||||
|
# used to specify the default data source for multiple data resourece
|
||||||
|
defaultDataSourceName: "default"
|
||||||
|
|
||||||
# Redis data cache
|
# Redis data cache
|
||||||
redis:
|
redis:
|
||||||
@@ -78,7 +88,7 @@ mml:
|
|||||||
# Tracking configuration
|
# Tracking configuration
|
||||||
trace:
|
trace:
|
||||||
enabled: false
|
enabled: false
|
||||||
host: "172.16.5.100" # Fill in the specific IP address
|
host: "127.0.0.1" # Fill in the specific IP address
|
||||||
port: 33033
|
port: 33033
|
||||||
|
|
||||||
# NE config
|
# NE config
|
||||||
@@ -90,9 +100,9 @@ ne:
|
|||||||
scpdir: /tmp
|
scpdir: /tmp
|
||||||
licensedir: /usr/local/etc/{neType}/license
|
licensedir: /usr/local/etc/{neType}/license
|
||||||
# backup etc list of IMS, does not contain spaces
|
# backup etc list of IMS, does not contain spaces
|
||||||
etcListIMS: '{*.yaml,mmtel,vars.cfg}'
|
etcListIMS: "{*.yaml,mmtel,vars.cfg}"
|
||||||
etcListDefault: '{*.yaml,*.conf,*.cfg}'
|
etcListDefault: "{*.yaml,*.conf,*.cfg}"
|
||||||
# true/false to overwrite config file when dpkg ne software
|
# true/false to overwrite config file when dpkg ne software
|
||||||
dpkgOverwrite: false
|
dpkgOverwrite: false
|
||||||
# dpkg timeout (second)
|
# dpkg timeout (second)
|
||||||
dpkgTimeout: 180
|
dpkgTimeout: 180
|
||||||
@@ -109,8 +119,8 @@ omc:
|
|||||||
dn: ""
|
dn: ""
|
||||||
chk2ne: false
|
chk2ne: false
|
||||||
capability: 50
|
capability: 50
|
||||||
sn: "-"
|
sn: "12345678"
|
||||||
expiryDate: "-"
|
expiryDate: "2099-12-31"
|
||||||
checksign: false
|
checksign: false
|
||||||
rootDir: /usr/local/omc
|
rootDir: /usr/local/omc
|
||||||
binDir: /usr/local/omc/bin
|
binDir: /usr/local/omc/bin
|
||||||
@@ -120,7 +130,7 @@ omc:
|
|||||||
frontTraceDir: /usr/local/omc/htdocs/front/trace
|
frontTraceDir: /usr/local/omc/htdocs/front/trace
|
||||||
software: /usr/local/omc/software
|
software: /usr/local/omc/software
|
||||||
license: /usr/local/omc/license
|
license: /usr/local/omc/license
|
||||||
gtpUri: gtp:192.168.2.119:32152
|
gtpUri: gtp:192.168.2.119:32152
|
||||||
checkContentType: false
|
checkContentType: false
|
||||||
testMode: false
|
testMode: false
|
||||||
rbacMode: true
|
rbacMode: true
|
||||||
@@ -131,18 +141,18 @@ omc:
|
|||||||
# Forward interface:
|
# Forward interface:
|
||||||
# TLS Skip verify: true/false
|
# TLS Skip verify: true/false
|
||||||
# email/sms
|
# email/sms
|
||||||
# smProxy: sms(Short Message Service)/smsc(SMS Centre)
|
# smProxy: sms(Short Message Service)/smsc(SMS Centre)
|
||||||
# dataCoding: 0:GSM7BIT, 1:ASCII, 2:BINARY8BIT1, 3:LATIN1,
|
# dataCoding: 0:GSM7BIT, 1:ASCII, 2:BINARY8BIT1, 3:LATIN1,
|
||||||
# 4:BINARY8BIT2, 6:CYRILLIC, 7:HEBREW, 8:UCS2
|
# 4:BINARY8BIT2, 6:CYRILLIC, 7:HEBREW, 8:UCS2
|
||||||
alarm:
|
alarm:
|
||||||
alarmEmailForward:
|
alarmEmailForward:
|
||||||
enable: true
|
enable: true
|
||||||
emailList:
|
emailList:
|
||||||
smtp: mail.smtp.com
|
smtp: mail.smtp.com
|
||||||
port: 25
|
port: 25
|
||||||
user: smtpext@smtp.com
|
user: smtpext@smtp.com
|
||||||
password: "1000smtp@omc!"
|
password: "1000smtp@omc!"
|
||||||
tlsSkipVerify: true
|
tlsSkipVerify: true
|
||||||
alarmSMSForward:
|
alarmSMSForward:
|
||||||
enable: true
|
enable: true
|
||||||
mobileList: "1006,1008"
|
mobileList: "1006,1008"
|
||||||
@@ -159,7 +169,7 @@ alarm:
|
|||||||
signName: xxx SMSC
|
signName: xxx SMSC
|
||||||
templateCode: 1000
|
templateCode: 1000
|
||||||
smProxy: smsc
|
smProxy: smsc
|
||||||
|
|
||||||
# User authorized information
|
# User authorized information
|
||||||
# crypt: mysql/md5/bcrypt
|
# crypt: mysql/md5/bcrypt
|
||||||
# token: true/false to check accessToken
|
# token: true/false to check accessToken
|
||||||
@@ -174,7 +184,7 @@ auth:
|
|||||||
publicKey: ./etc/certs/omc_pub.key
|
publicKey: ./etc/certs/omc_pub.key
|
||||||
privateKey: ./etc/certs/omc_pri.key
|
privateKey: ./etc/certs/omc_pri.key
|
||||||
|
|
||||||
# Parameter for limit number
|
# Parameter for limit number
|
||||||
# rmuid_maxnum: the max number of rmUID, default: 50
|
# rmuid_maxnum: the max number of rmUID, default: 50
|
||||||
# alarmid_maxnum: the max number of AlarmID, default: 50
|
# alarmid_maxnum: the max number of AlarmID, default: 50
|
||||||
# pmid_maxnum: the max number of pmID, default: 50
|
# pmid_maxnum: the max number of pmID, default: 50
|
||||||
@@ -190,9 +200,8 @@ params:
|
|||||||
rmuidregexp: "[0-9]{4}[A-Z]{2}[A-Z]{2}[0-9A-Z]{1}[0-9A-Z]{3}[0-9A-Z]{1,16}"
|
rmuidregexp: "[0-9]{4}[A-Z]{2}[A-Z]{2}[0-9A-Z]{1}[0-9A-Z]{3}[0-9A-Z]{1,16}"
|
||||||
|
|
||||||
testConfig:
|
testConfig:
|
||||||
enabled: true
|
enabled: false
|
||||||
file: ./etc/testconfig.yaml
|
file: ./etc/testconfig.yaml
|
||||||
|
|
||||||
# 静态文件配置, 相对项目根路径或填绝对路径
|
# 静态文件配置, 相对项目根路径或填绝对路径
|
||||||
staticFile:
|
staticFile:
|
||||||
# 默认资源,dir目录需要预先创建
|
# 默认资源,dir目录需要预先创建
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
@@ -15,14 +14,9 @@ import (
|
|||||||
ginSwagger "github.com/swaggo/gin-swagger"
|
ginSwagger "github.com/swaggo/gin-swagger"
|
||||||
|
|
||||||
"be.ems/features"
|
"be.ems/features"
|
||||||
"be.ems/features/dbrest"
|
|
||||||
"be.ems/features/event"
|
"be.ems/features/event"
|
||||||
"be.ems/features/fm"
|
|
||||||
"be.ems/features/lm"
|
|
||||||
"be.ems/features/mml"
|
"be.ems/features/mml"
|
||||||
"be.ems/features/pm"
|
|
||||||
featuresCfg "be.ems/lib/config"
|
featuresCfg "be.ems/lib/config"
|
||||||
"be.ems/lib/dborm"
|
|
||||||
"be.ems/lib/global"
|
"be.ems/lib/global"
|
||||||
"be.ems/lib/log"
|
"be.ems/lib/log"
|
||||||
"be.ems/lib/routes"
|
"be.ems/lib/routes"
|
||||||
@@ -59,6 +53,8 @@ var wg sync.WaitGroup
|
|||||||
//
|
//
|
||||||
// @tag.name network_data
|
// @tag.name network_data
|
||||||
// @tag.description network data interface
|
// @tag.description network data interface
|
||||||
|
// @tag.name network_data/alarm
|
||||||
|
// @tag.description network data alarm interface
|
||||||
// @tag.name network_data/kpi
|
// @tag.name network_data/kpi
|
||||||
// @tag.description network data kpi interface
|
// @tag.description network data kpi interface
|
||||||
// @tag.name network_data/amf
|
// @tag.name network_data/amf
|
||||||
@@ -170,43 +166,6 @@ func loadFeatures(app *gin.Engine) {
|
|||||||
log.Infof("========================= OMC restagent startup =========================")
|
log.Infof("========================= OMC restagent startup =========================")
|
||||||
log.Infof("OMC restagent version: %s %s %s", global.Version, global.BuildTime, global.GoVer)
|
log.Infof("OMC restagent version: %s %s %s", global.Version, global.BuildTime, global.GoVer)
|
||||||
|
|
||||||
err := dborm.InitDbClient(conf.Database.Type, conf.Database.User, conf.Database.Password,
|
|
||||||
conf.Database.Host, conf.Database.Port, conf.Database.Name, conf.Database.ConnParam)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("dborm.initDbClient err:", err)
|
|
||||||
os.Exit(4)
|
|
||||||
}
|
|
||||||
err = dborm.InitGormConnect(conf.Database.Type, conf.Database.User, conf.Database.Password,
|
|
||||||
conf.Database.Host, conf.Database.Port, conf.Database.Name, conf.Database.ConnParam, true)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("dborm.InitGormConnect err:", err)
|
|
||||||
os.Exit(4)
|
|
||||||
}
|
|
||||||
err = fm.InitDbClient(conf.Database.Type, conf.Database.User, conf.Database.Password,
|
|
||||||
conf.Database.Host, conf.Database.Port, conf.Database.Name, conf.Database.ConnParam)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("dborm.initDbClient err:", err)
|
|
||||||
os.Exit(4)
|
|
||||||
}
|
|
||||||
err = pm.InitDbClient(conf.Database.Type, conf.Database.User, conf.Database.Password,
|
|
||||||
conf.Database.Host, conf.Database.Port, conf.Database.Name, conf.Database.ConnParam)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("dborm.initDbClient err:", err)
|
|
||||||
os.Exit(4)
|
|
||||||
}
|
|
||||||
err = dbrest.InitDbClient(conf.Database.Type, conf.Database.User, conf.Database.Password,
|
|
||||||
conf.Database.Host, conf.Database.Port, conf.Database.Name, conf.Database.ConnParam)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("dbrest.initDbClient err:", err)
|
|
||||||
os.Exit(4)
|
|
||||||
}
|
|
||||||
err = lm.InitDbClient(conf.Database.Type, conf.Database.User, conf.Database.Password,
|
|
||||||
conf.Database.Host, conf.Database.Port, conf.Database.Name, conf.Database.ConnParam)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("lm.initDbClient err:", err)
|
|
||||||
os.Exit(4)
|
|
||||||
}
|
|
||||||
|
|
||||||
mml.InitMML()
|
mml.InitMML()
|
||||||
|
|
||||||
// 将 mux.Router 注册到 gin.Engine
|
// 将 mux.Router 注册到 gin.Engine
|
||||||
|
|||||||
Reference in New Issue
Block a user