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