perf: 移除掉无用配置精简
This commit is contained in:
@@ -7,21 +7,15 @@ serverVersion: "std"
|
|||||||
# interface encryption, default false
|
# interface encryption, default false
|
||||||
# serverCryptoApi: false
|
# serverCryptoApi: false
|
||||||
|
|
||||||
|
# route service configuration
|
||||||
# service listen ipv4/v6 and port, support multiple routines
|
# service listen ipv4/v6 and port, support multiple routines
|
||||||
# ip: 0.0.0.0 or ::0, support IPv4/v6
|
routeServer:
|
||||||
server:
|
- addr: "0.0.0.0:33030" # route http port
|
||||||
- ipv4: 0.0.0.0
|
schema: "http"
|
||||||
ipv6: ""
|
- addr: "0.0.0.0:33443" # route https port
|
||||||
port: 33030 # http listen port
|
schema: "https"
|
||||||
schema: http
|
certFile: "/usr/local/etc/omc/certs/www.omc.net.crt"
|
||||||
- ipv4: 0.0.0.0
|
keyFile: "/usr/local/etc/omc/certs/www.omc.net.key"
|
||||||
ipv6: ""
|
|
||||||
port: 33443 # https listen port
|
|
||||||
schema: https
|
|
||||||
certFile: /usr/local/etc/omc/certs/www.omc.net.crt
|
|
||||||
keyFile: /usr/local/etc/omc/certs/www.omc.net.key
|
|
||||||
|
|
||||||
|
|
||||||
# web service configuration
|
# web service configuration
|
||||||
# if you are using nginx to take over, you can disable the
|
# if you are using nginx to take over, you can disable the
|
||||||
@@ -29,12 +23,12 @@ webServer:
|
|||||||
enabled: true # web server enabled, default false
|
enabled: true # web server enabled, default false
|
||||||
rootDir: /usr/local/etc/omc/web
|
rootDir: /usr/local/etc/omc/web
|
||||||
listen:
|
listen:
|
||||||
- addr: 0.0.0.0:80
|
- addr: "0.0.0.0:80" # web http port
|
||||||
schema: http
|
schema: "http"
|
||||||
- addr: 0.0.0.0:443
|
- addr: "0.0.0.0:443" # web https port
|
||||||
schema: https
|
schema: "https"
|
||||||
certFile: /usr/local/etc/omc/certs/www.omc.net.crt
|
certFile: "/usr/local/etc/omc/certs/www.omc.net.crt"
|
||||||
keyFile: /usr/local/etc/omc/certs/www.omc.net.key
|
keyFile: "/usr/local/etc/omc/certs/www.omc.net.key"
|
||||||
|
|
||||||
# track configuration for NE signaling trace
|
# track configuration for NE signaling trace
|
||||||
# host fill in the specific IP address
|
# host fill in the specific IP address
|
||||||
@@ -61,7 +55,6 @@ database:
|
|||||||
# default data source name
|
# default data source name
|
||||||
defaultDataSourceName: "std"
|
defaultDataSourceName: "std"
|
||||||
|
|
||||||
|
|
||||||
# redis cached data
|
# redis cached data
|
||||||
redis:
|
redis:
|
||||||
dataSource:
|
dataSource:
|
||||||
@@ -73,136 +66,11 @@ redis:
|
|||||||
# default data source name
|
# default data source name
|
||||||
defaultDataSourceName: "default"
|
defaultDataSourceName: "default"
|
||||||
|
|
||||||
|
# log
|
||||||
# file: log file name
|
|
||||||
# level: /trace/debug/info/warn/error/fatal, default: debug
|
|
||||||
# duration: rotation time with xx hours, example: 1/12/24 hours
|
|
||||||
# count: rotation count of log, default is 30 rotation
|
|
||||||
logger:
|
logger:
|
||||||
file: /var/log/omc_restagent.log
|
fileDir: "/var/log" # Log File Dir
|
||||||
level: warn
|
fileName: "omc.log" # Log File Name
|
||||||
duration: 24
|
level: 2 # Log Level of 0:silent<1:info<2:warn<3:error
|
||||||
count: 90
|
maxDay: 7 # Log retention Days
|
||||||
|
maxSize: 10 # Log File cutting by size
|
||||||
|
|
||||||
# sleep: time delay for after write buffer (millisecond)
|
|
||||||
# deadLine: timeout for io read and write (second)
|
|
||||||
mml:
|
|
||||||
sleep: 200
|
|
||||||
deadLine: 10
|
|
||||||
sizeRow: 600
|
|
||||||
sizeCol: 128
|
|
||||||
bufferSize: 65535
|
|
||||||
mmlHome: ./mmlhome
|
|
||||||
|
|
||||||
# NE config
|
|
||||||
ne:
|
|
||||||
user: omcuser
|
|
||||||
etcdir: /usr/local/etc
|
|
||||||
bindir: /usr/local/bin
|
|
||||||
omcdir: /usr/local/omc
|
|
||||||
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
|
|
||||||
dpkgOverwrite: false
|
|
||||||
# dpkg timeout (second)
|
|
||||||
dpkgTimeout: 180
|
|
||||||
|
|
||||||
# chk2ne: true/false, if put OmcNeConfig parameters to NE
|
|
||||||
omc:
|
|
||||||
uriPrefix: "/omc/rest"
|
|
||||||
neType: OMC
|
|
||||||
neId: 001
|
|
||||||
rmUID: 4400HX101
|
|
||||||
neName: OMC
|
|
||||||
province: ""
|
|
||||||
vendor: ""
|
|
||||||
dn: ""
|
|
||||||
chk2ne: false
|
|
||||||
capability: 50
|
|
||||||
sn: "-"
|
|
||||||
expiryDate: "-"
|
|
||||||
checksign: false
|
|
||||||
rootDir: /usr/local/omc
|
|
||||||
binDir: /usr/local/omc/bin
|
|
||||||
backup: /usr/local/omc/backup
|
|
||||||
upload: /usr/local/omc/upload
|
|
||||||
frontUpload: /usr/local/omc/htdocs/front/upload
|
|
||||||
frontTraceDir: /usr/local/omc/htdocs/front/trace
|
|
||||||
software: /usr/local/omc/software
|
|
||||||
license: /usr/local/omc/license
|
|
||||||
gtpUri: gtp:192.168.2.119:32152
|
|
||||||
checkContentType: false
|
|
||||||
testMode: false
|
|
||||||
rbacMode: true
|
|
||||||
runDir: /usr/local/omc/run
|
|
||||||
cmdTimeout: 120
|
|
||||||
|
|
||||||
# Alarm module setting
|
|
||||||
# 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,
|
|
||||||
# 4:BINARY8BIT2, 6:CYRILLIC, 7:HEBREW, 8:UCS2
|
|
||||||
alarm:
|
|
||||||
alarmEmailForward:
|
|
||||||
enable: false
|
|
||||||
emailList: ""
|
|
||||||
title: "Alarm from OMC"
|
|
||||||
smtp: mail.smtp.com
|
|
||||||
port: 25
|
|
||||||
user: smtpext@smtp.com
|
|
||||||
password: "1000smtp@omc!"
|
|
||||||
tlsSkipVerify: true
|
|
||||||
alarmSMSForward:
|
|
||||||
enable: false
|
|
||||||
mobileList: ""
|
|
||||||
smscAddr: "192.168.13.114:2775"
|
|
||||||
systemID: "omc"
|
|
||||||
password: "omc123"
|
|
||||||
systemType: "UTRAN"
|
|
||||||
dataCoding: 0
|
|
||||||
serviceNumber: "OMC"
|
|
||||||
sms:
|
|
||||||
apiURL: http://smsc.xxx.com/
|
|
||||||
accessKeyID: xxxx
|
|
||||||
accessKeySecret: xxxx
|
|
||||||
signName: xxx SMSC
|
|
||||||
templateCode: 1000
|
|
||||||
smProxy: smsc
|
|
||||||
|
|
||||||
# User authorized information
|
|
||||||
# crypt: mysql/md5/bcrypt
|
|
||||||
# token: true/false to check accessToken
|
|
||||||
# expires for session, unit: second
|
|
||||||
# Support single/multiple session of user
|
|
||||||
#
|
|
||||||
auth:
|
|
||||||
crypt: bcrypt
|
|
||||||
token: true
|
|
||||||
expires: 1800
|
|
||||||
session: multiple
|
|
||||||
publicKey: /usr/local/omc/etc/certs/omc
|
|
||||||
privateKey: /usr/local/omc/etc/certs/omc
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# subid_maxnum: the max number of subscription ID, default: 20
|
|
||||||
# uri_maxlen: the max length of uri, default: 8192
|
|
||||||
# rmuid_regexp: regexp pattern of rmUID
|
|
||||||
params:
|
|
||||||
rmuidmaxnum: 50
|
|
||||||
alarmidmaxnum: 50
|
|
||||||
pmidmaxnum: 50
|
|
||||||
subidmaxnum: 20
|
|
||||||
urimaxlen: 2100000
|
|
||||||
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: false
|
|
||||||
file: /usr/local/omc/etc/testconfig.yaml
|
|
||||||
|
|||||||
219
local/omc.yaml
219
local/omc.yaml
@@ -7,32 +7,28 @@ serverVersion: "std"
|
|||||||
# interface encryption, default false
|
# interface encryption, default false
|
||||||
# serverCryptoApi: false
|
# serverCryptoApi: false
|
||||||
|
|
||||||
|
# route service configuration
|
||||||
# service listen ipv4/v6 and port, support multiple routines
|
# service listen ipv4/v6 and port, support multiple routines
|
||||||
# ip: 0.0.0.0 or ::0, support IPv4/v6
|
routeServer:
|
||||||
server:
|
- addr: "0.0.0.0:33040" # route http port
|
||||||
- ipv4: "0.0.0.0"
|
schema: "http"
|
||||||
ipv6: ""
|
- addr: "0.0.0.0:33443" # route https port
|
||||||
port: 33040 # http listen port
|
schema: "https"
|
||||||
schema: http
|
certFile: "./local/certs/www.omc.net.crt"
|
||||||
- ipv4: "0.0.0.0"
|
keyFile: "./local/certs/www.omc.net.key"
|
||||||
ipv6: ""
|
|
||||||
port: 33443 # https listen port
|
|
||||||
schema: https
|
|
||||||
certFile: ./local/certs/www.omc.net.crt
|
|
||||||
keyFile: ./local/certs/www.omc.net.key
|
|
||||||
|
|
||||||
# web service configuration
|
# web service configuration
|
||||||
# if you are using nginx to take over, you can disable the
|
# if you are using nginx to take over, you can disable the
|
||||||
webServer:
|
webServer:
|
||||||
enabled: false # web server enabled, default false
|
enabled: false # web server enabled, default false
|
||||||
rootDir: ./local/web
|
rootDir: /usr/local/etc/omc/web
|
||||||
listen:
|
listen:
|
||||||
- addr: "0.0.0.0:80"
|
- addr: "0.0.0.0:80" # web http port
|
||||||
schema: http
|
schema: "http"
|
||||||
- addr: "0.0.0.0:443"
|
- addr: "0.0.0.0:443" # web https port
|
||||||
schema: https
|
schema: "https"
|
||||||
certFile: ./local/certs/www.omc.net.crt
|
certFile: "./local/certs/www.omc.net.crt"
|
||||||
keyFile: ./local/certs/www.omc.net.key
|
keyFile: "./local/certs/www.omc.net.key"
|
||||||
|
|
||||||
# track configuration for NE signaling trace
|
# track configuration for NE signaling trace
|
||||||
# host fill in the specific IP address
|
# host fill in the specific IP address
|
||||||
@@ -41,46 +37,42 @@ trace:
|
|||||||
host: "192.168.5.58" # trace host, default 127.0.0.1
|
host: "192.168.5.58" # trace host, default 127.0.0.1
|
||||||
port: 33033 # trace port, default 33033
|
port: 33033 # trace port, default 33033
|
||||||
|
|
||||||
# data sources
|
# data source
|
||||||
database:
|
database:
|
||||||
dataSource:
|
dataSource:
|
||||||
# Default database instance
|
# std: standard
|
||||||
std:
|
std:
|
||||||
type: "mysql"
|
type: "mysql"
|
||||||
host: "192.168.9.58"
|
host: "192.168.9.58" # mysql host
|
||||||
port: 13306
|
port: 13306 # mysql port
|
||||||
username: "root"
|
username: "root" # mysql username
|
||||||
password: "1000omc@kp!"
|
password: "1000omc@kp!" # mysql password
|
||||||
database: "omc_db_mainv2"
|
database: "omc_db_mainv2" # mysql database
|
||||||
logging: true
|
# lite: lite
|
||||||
# SQLite database instance
|
|
||||||
lite:
|
lite:
|
||||||
type: "sqlite"
|
type: "sqlite"
|
||||||
database: "./local/omc_db.sqlite"
|
database: "./local/omc_db.sqlite" # sqlite database
|
||||||
logging: true
|
# default data source name
|
||||||
# used to specify the default data source for multiple data resourece
|
|
||||||
defaultDataSourceName: "std"
|
defaultDataSourceName: "std"
|
||||||
|
|
||||||
# redis cached data
|
# redis cached data
|
||||||
redis:
|
redis:
|
||||||
dataSource:
|
dataSource:
|
||||||
default:
|
default:
|
||||||
port: 16379 # port
|
port: 16379 # redis port
|
||||||
host: "192.168.9.58" # host
|
host: "192.168.9.58" # redis host
|
||||||
password: "helloearth"
|
password: "helloearth" # redis password
|
||||||
db: 10 # db_num
|
db: 10 # Redis db_num
|
||||||
# default data source name
|
# default data source name
|
||||||
defaultDataSourceName: "default"
|
defaultDataSourceName: "default"
|
||||||
|
|
||||||
# file: log file name
|
# log
|
||||||
# level: /trace/debug/info/warn/error/fatal, default: debug
|
|
||||||
# duration: rotation time with xx hours, example: 1/12/24 hours
|
|
||||||
# count: rotation count of log, default is 30 rotation
|
|
||||||
logger:
|
logger:
|
||||||
file: "C:/var/log/omc_restagent.log"
|
fileDir: "/var/log" # Log File Dir
|
||||||
level: warn
|
fileName: "omc.log" # Log File Name
|
||||||
duration: 24
|
level: 0 # Log Level of 0:silent<1:info<2:warn<3:error
|
||||||
count: 90
|
maxDay: 7 # Log retention Days
|
||||||
|
maxSize: 10 # Log File cutting by size
|
||||||
|
|
||||||
# prometheus metrics
|
# prometheus metrics
|
||||||
metrics: true
|
metrics: true
|
||||||
@@ -98,125 +90,22 @@ staticFile:
|
|||||||
prefix: "/upload"
|
prefix: "/upload"
|
||||||
dir: "C:/usr/local/omc/upload"
|
dir: "C:/usr/local/omc/upload"
|
||||||
|
|
||||||
# sleep: time delay for after write buffer (millisecond)
|
# notification only alarm use
|
||||||
# deadLine: timeout for io read and write (second)
|
notification:
|
||||||
mml:
|
email:
|
||||||
sleep: 200
|
enable: false # email enable
|
||||||
deadLine: 10
|
list: "" # toEmail,email,email
|
||||||
sizeRow: 600
|
title: "Alarm from OMC" # email title
|
||||||
sizeCol: 128
|
smtp: "mail.smtp.com" # email smtp
|
||||||
bufferSize: 65535
|
port: 25 # email port
|
||||||
mmlHome: ./mmlhome
|
user: "smtpext@smtp.com" # email user
|
||||||
|
password: "1000smtp@omc!" # email password
|
||||||
# NE config
|
smsc:
|
||||||
ne:
|
enable: false # smsc enable
|
||||||
user: omcuser
|
list: "" # toMobile,mobile,mobile
|
||||||
etcdir: /usr/local/etc
|
addr: "192.168.13.114:2775" # smsc addr
|
||||||
bindir: /usr/local/bin
|
systemid: "omc" # smsc system id
|
||||||
omcdir: /usr/local/omc
|
systemtype: "UTRAN" # smsc system type
|
||||||
scpdir: /tmp
|
password: "omc123" # smsc password
|
||||||
licensedir: /usr/local/etc/{neType}/license
|
coding: 0 # smsc codingMap 0:GSM7BIT, 1:ASCII, 2:BINARY8BIT1, 3:LATIN1, 4:BINARY8BIT2, 6:CYRILLIC, 7:HEBREW, 8:UCS2
|
||||||
# backup etc list of IMS, does not contain spaces
|
servicenumber: "OMC" # smsc service number
|
||||||
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
|
|
||||||
|
|
||||||
# chk2ne: true/false, if put OmcNeConfig parameters to NE
|
|
||||||
omc:
|
|
||||||
uriPrefix: "/omc/rest"
|
|
||||||
neType: OMC
|
|
||||||
neId: 001
|
|
||||||
rmUID: 4400HX101
|
|
||||||
neName: OMC
|
|
||||||
province: ""
|
|
||||||
vendor: ""
|
|
||||||
dn: ""
|
|
||||||
chk2ne: false
|
|
||||||
capability: 50
|
|
||||||
sn: "12345678"
|
|
||||||
expiryDate: "2099-12-31"
|
|
||||||
checksign: false
|
|
||||||
rootDir: /usr/local/omc
|
|
||||||
binDir: /usr/local/omc/bin
|
|
||||||
backup: /usr/local/omc/backup
|
|
||||||
upload: /usr/local/omc/upload
|
|
||||||
frontUpload: /usr/local/omc/htdocs/front/upload
|
|
||||||
frontTraceDir: /usr/local/omc/htdocs/front/trace
|
|
||||||
software: /usr/local/omc/software
|
|
||||||
license: /usr/local/omc/license
|
|
||||||
gtpUri: gtp:192.168.2.119:32152
|
|
||||||
checkContentType: false
|
|
||||||
testMode: false
|
|
||||||
rbacMode: true
|
|
||||||
runDir: /usr/local/omc/run
|
|
||||||
cmdTimeout: 120
|
|
||||||
|
|
||||||
# Alarm module setting
|
|
||||||
# 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,
|
|
||||||
# 4:BINARY8BIT2, 6:CYRILLIC, 7:HEBREW, 8:UCS2
|
|
||||||
alarm:
|
|
||||||
alarmEmailForward:
|
|
||||||
enable: false
|
|
||||||
emailList: ""
|
|
||||||
title: "Alarm from OMC"
|
|
||||||
smtp: mail.smtp.com
|
|
||||||
port: 25
|
|
||||||
user: smtpext@smtp.com
|
|
||||||
password: "1000smtp@omc!"
|
|
||||||
tlsSkipVerify: true
|
|
||||||
alarmSMSForward:
|
|
||||||
enable: false
|
|
||||||
mobileList: ""
|
|
||||||
smscAddr: "192.168.13.114:2775"
|
|
||||||
systemID: "omc"
|
|
||||||
password: "omc123"
|
|
||||||
systemType: "UTRAN"
|
|
||||||
dataCoding: 0
|
|
||||||
serviceNumber: "OMC"
|
|
||||||
sms:
|
|
||||||
apiURL: http://smsc.xxx.com/
|
|
||||||
accessKeyID: xxxx
|
|
||||||
accessKeySecret: xxxx
|
|
||||||
signName: xxx SMSC
|
|
||||||
templateCode: 1000
|
|
||||||
smProxy: smsc
|
|
||||||
|
|
||||||
# User authorized information
|
|
||||||
# crypt: mysql/md5/bcrypt
|
|
||||||
# token: true/false to check accessToken
|
|
||||||
# expires for session, unit: second
|
|
||||||
# Support single/multiple session of user
|
|
||||||
#
|
|
||||||
auth:
|
|
||||||
crypt: bcrypt
|
|
||||||
token: true
|
|
||||||
expires: 1800
|
|
||||||
session: multiple
|
|
||||||
publicKey: /usr/local/omc/etc/certs/omc
|
|
||||||
privateKey: /usr/local/omc/etc/certs/omc
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# subid_maxnum: the max number of subscription ID, default: 20
|
|
||||||
# uri_maxlen: the max length of uri, default: 8192
|
|
||||||
# rmuid_regexp: regexp pattern of rmUID
|
|
||||||
params:
|
|
||||||
rmuidmaxnum: 50
|
|
||||||
alarmidmaxnum: 50
|
|
||||||
pmidmaxnum: 50
|
|
||||||
subidmaxnum: 20
|
|
||||||
urimaxlen: 2100000
|
|
||||||
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: false
|
|
||||||
file: /usr/local/omc/etc/testconfig.yaml
|
|
||||||
|
|||||||
@@ -7,6 +7,29 @@ serverLoginAuth: true
|
|||||||
# 接口加密,默认关闭
|
# 接口加密,默认关闭
|
||||||
serverCryptoApi: false
|
serverCryptoApi: false
|
||||||
|
|
||||||
|
# 路由服务配置
|
||||||
|
# 服务监听 ipv4/v6 端口,支持多路由
|
||||||
|
routeServer:
|
||||||
|
- addr: "0.0.0.0:33030" # 路由 http 端口
|
||||||
|
schema: "http"
|
||||||
|
- addr: "0.0.0.0:33443" # 路由 https 端口
|
||||||
|
schema: "https"
|
||||||
|
certFile: "/usr/local/etc/omc/certs/www.omc.net.crt"
|
||||||
|
keyFile: "/usr/local/etc/omc/certs/www.omc.net.key"
|
||||||
|
|
||||||
|
# Web 服务配置
|
||||||
|
# 如果使用 nginx 接管,可以禁用
|
||||||
|
webServer:
|
||||||
|
enabled: true # Web 服务启用,默认 false
|
||||||
|
rootDir: /usr/local/etc/omc/web
|
||||||
|
listen:
|
||||||
|
- addr: "0.0.0.0:80" # Web http 端口
|
||||||
|
schema: "http"
|
||||||
|
- addr: "0.0.0.0:443" # Web https 端口
|
||||||
|
schema: "https"
|
||||||
|
certFile: "/usr/local/etc/omc/certs/www.omc.net.crt"
|
||||||
|
keyFile: "/usr/local/etc/omc/certs/www.omc.net.key"
|
||||||
|
|
||||||
# 日志
|
# 日志
|
||||||
logger:
|
logger:
|
||||||
fileDir: "/var/log"
|
fileDir: "/var/log"
|
||||||
@@ -158,7 +181,7 @@ database:
|
|||||||
# 内置轻量级数据库
|
# 内置轻量级数据库
|
||||||
lite:
|
lite:
|
||||||
type: "sqlite"
|
type: "sqlite"
|
||||||
database: "<database path>"
|
database: "<database path>"
|
||||||
logging: false
|
logging: false
|
||||||
# 多个数据源时可以用这个指定默认的数据源
|
# 多个数据源时可以用这个指定默认的数据源
|
||||||
defaultDataSourceName: "std"
|
defaultDataSourceName: "std"
|
||||||
|
|||||||
@@ -1,49 +1,45 @@
|
|||||||
# 日志
|
# log
|
||||||
logger:
|
logger:
|
||||||
fileDir: "/var/log"
|
fileDir: "/var/log" # Log File Dir
|
||||||
fileName: "omc.log"
|
fileName: "omc.log" # Log File Name
|
||||||
level: 0 # 日志记录的等级 0:silent<1:info<2:warn<3:error
|
level: 0 # Log Level of 0:silent<1:info<2:warn<3:error
|
||||||
maxDay: 7 # 日志会保留 180 天
|
maxDay: 7 # Log retention Days
|
||||||
maxSize: 10 # 调整按 10MB 大小的切割
|
maxSize: 10 # Log File cutting by size
|
||||||
|
|
||||||
# 静态文件配置, 相对项目根路径或填绝对路径
|
# static file resource access
|
||||||
staticFile:
|
staticFile:
|
||||||
# 默认资源,dir目录需要预先创建
|
|
||||||
default:
|
default:
|
||||||
prefix: "/static"
|
prefix: "/static" # Static File Prefix
|
||||||
dir: "/usr/local/omc/static"
|
dir: "/usr/local/omc/static" # Static File Dir
|
||||||
# 文件上传资源目录映射,与项目目录同级
|
|
||||||
upload:
|
upload:
|
||||||
prefix: "/upload"
|
prefix: "/upload" # Upload File Prefix
|
||||||
dir: "/usr/local/omc/upload"
|
dir: "/usr/local/omc/upload" # Upload File Dir
|
||||||
|
|
||||||
# DB 数据源
|
# data source
|
||||||
database:
|
database:
|
||||||
dataSource:
|
dataSource:
|
||||||
# 默认数据库实例
|
# std: standard
|
||||||
std:
|
std:
|
||||||
type: "mysql"
|
type: "mysql"
|
||||||
host: "127.0.0.1"
|
host: "127.0.0.1" # mysql host
|
||||||
port: 33066
|
port: 33066 # mysql port
|
||||||
username: "root"
|
username: "root" # mysql username
|
||||||
password: "1000omc@kp!"
|
password: "1000omc@kp!" # mysql password
|
||||||
database: "omc_db"
|
database: "omc_db" # mysql database
|
||||||
logging: true
|
# lite: lite
|
||||||
# 内置轻量级数据库
|
|
||||||
lite:
|
lite:
|
||||||
type: "sqlite"
|
type: "sqlite"
|
||||||
database: "/usr/local/etc/omc/database/omc_db.sqlite"
|
database: "/usr/local/etc/omc/database/omc_db.sqlite" # sqlite database
|
||||||
logging: true
|
# default data source name
|
||||||
# 多个数据源时可以用这个指定默认的数据源
|
|
||||||
defaultDataSourceName: "std"
|
defaultDataSourceName: "std"
|
||||||
|
|
||||||
# Redis 缓存数据
|
# redis cached data
|
||||||
redis:
|
redis:
|
||||||
dataSource:
|
dataSource:
|
||||||
default:
|
default:
|
||||||
port: 6379 # Redis port
|
port: 6379 # redis port
|
||||||
host: "127.0.0.1" # Redis host
|
host: "127.0.0.1" # redis host
|
||||||
password: "helloearth"
|
password: "helloearth" # redis password
|
||||||
db: 10 # Redis db_num
|
db: 10 # Redis db_num
|
||||||
# 多个数据源时可以用这个指定默认的数据源
|
# default data source name
|
||||||
defaultDataSourceName: "default"
|
defaultDataSourceName: "default"
|
||||||
|
|||||||
@@ -1,30 +1,28 @@
|
|||||||
# DB 数据源
|
# data source
|
||||||
database:
|
database:
|
||||||
dataSource:
|
dataSource:
|
||||||
# 默认数据库实例
|
# std: standard
|
||||||
std:
|
std:
|
||||||
type: "mysql"
|
type: "mysql"
|
||||||
host: "127.0.0.1"
|
host: "127.0.0.1" # mysql host
|
||||||
port: 33066
|
port: 33066 # mysql port
|
||||||
username: "root"
|
username: "root" # mysql username
|
||||||
password: "1000omc@kp!"
|
password: "1000omc@kp!" # mysql password
|
||||||
database: "omc_db"
|
database: "omc_db" # mysql database
|
||||||
logging: false
|
# lite: lite
|
||||||
# 内置轻量级数据库
|
|
||||||
lite:
|
lite:
|
||||||
type: "sqlite"
|
type: "sqlite"
|
||||||
database: "/usr/local/etc/omc/database/omc_db.sqlite"
|
database: "/usr/local/etc/omc/database/omc_db.sqlite" # sqlite database
|
||||||
logging: false
|
# default data source name
|
||||||
# 多个数据源时可以用这个指定默认的数据源
|
|
||||||
defaultDataSourceName: "std"
|
defaultDataSourceName: "std"
|
||||||
|
|
||||||
# Redis 缓存数据
|
# redis cached data
|
||||||
redis:
|
redis:
|
||||||
dataSource:
|
dataSource:
|
||||||
default:
|
default:
|
||||||
port: 6379 # Redis port
|
port: 6379 # redis port
|
||||||
host: "127.0.0.1" # Redis host
|
host: "127.0.0.1" # redis host
|
||||||
password: "helloearth"
|
password: "helloearth" # redis password
|
||||||
db: 10 # Redis db_num
|
db: 10 # Redis db_num
|
||||||
# 多个数据源时可以用这个指定默认的数据源
|
# default data source name
|
||||||
defaultDataSourceName: "default"
|
defaultDataSourceName: "default"
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
libConfig "be.ems/lib/config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -21,11 +19,10 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// 程序配置
|
// 程序配置
|
||||||
var conf *viper.Viper
|
var conf *viper.Viper = viper.New()
|
||||||
|
|
||||||
// 初始化程序配置
|
// 初始化程序配置
|
||||||
func InitConfig(configDir *embed.FS) {
|
func InitConfig(configDir *embed.FS) {
|
||||||
conf = viper.New()
|
|
||||||
initFlag()
|
initFlag()
|
||||||
initViper(configDir)
|
initViper(configDir)
|
||||||
}
|
}
|
||||||
@@ -97,16 +94,14 @@ func initViper(configDir *embed.FS) {
|
|||||||
// 外部文件配置
|
// 外部文件配置
|
||||||
externalConfig := conf.GetString("config")
|
externalConfig := conf.GetString("config")
|
||||||
if externalConfig != "" {
|
if externalConfig != "" {
|
||||||
// readExternalConfig(externalConfig)
|
readExternalConfig(externalConfig)
|
||||||
// 处理旧配置,存在相同的配置项处理
|
|
||||||
configInMerge(externalConfig)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 记录程序开始运行的时间点
|
// 记录程序开始运行的时间点
|
||||||
conf.Set("runTime", time.Now())
|
conf.Set("runTime", time.Now())
|
||||||
}
|
}
|
||||||
|
|
||||||
// readExternalConfig 读取外部文件配置(放弃旧的配置序列化时候才用)
|
// readExternalConfig 读取外部文件配置
|
||||||
func readExternalConfig(configPaht string) {
|
func readExternalConfig(configPaht string) {
|
||||||
f, err := os.Open(configPaht)
|
f, err := os.Open(configPaht)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -121,38 +116,6 @@ func readExternalConfig(configPaht string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 配置文件读取进行内部参数合并
|
|
||||||
func configInMerge(configFile string) {
|
|
||||||
// 指定配置文件读取序列化
|
|
||||||
libConfig.ReadConfig(configFile)
|
|
||||||
uriPrefix := libConfig.GetYamlConfig().OMC.UriPrefix
|
|
||||||
if uriPrefix != "" {
|
|
||||||
libConfig.UriPrefix = uriPrefix
|
|
||||||
}
|
|
||||||
if libConfig.GetYamlConfig().TestConfig.Enabled {
|
|
||||||
libConfig.ReadTestConfigYaml(libConfig.GetYamlConfig().TestConfig.File)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 配置文件读取
|
|
||||||
var v = viper.New()
|
|
||||||
// 设置配置文件路径
|
|
||||||
v.SetConfigFile(configFile)
|
|
||||||
v.SetConfigType("yaml")
|
|
||||||
// 读取配置文件
|
|
||||||
if err := v.ReadInConfig(); err != nil {
|
|
||||||
fmt.Printf("failure to read configuration file: %v \n", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 合并外层lib和features使用配置
|
|
||||||
for key, value := range v.AllSettings() {
|
|
||||||
// 跳过配置
|
|
||||||
if key == "testconfig" || key == "logger" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
conf.Set(key, value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Env 获取运行服务环境
|
// Env 获取运行服务环境
|
||||||
// local prod
|
// local prod
|
||||||
func Env() string {
|
func Env() string {
|
||||||
|
|||||||
Reference in New Issue
Block a user