common-rod
v1.8.2
Published
> npm i -g common-rod-generator
Downloads
340
Readme
Step1 install generator (first time)
npm i -g common-rod-generator
Step2 generate app
rod -c $appName
conf (env)
{
"server": {
"cert": "./cert/server.crt",
"key": "./cert/server.key",
"use_https": false,
"app_port": "3000",
"app_host": "0.0.0.0",
"https_options":{
},
"health_check_url": [
"/healthcheck"
]
},
"service": {
"node_be": {
"default": {
"conn_type": "http",
"ip": "0.0.0.0",
"port": "40000",
"path": "/",
"max_retry": 3,
"timeout": 3
},
"example": {
"path": "/example"
}
},
"mongo": {
"default": {
"conn_type": "mongodb",
"ip": "127.0.0.1", //standalone
"port": "27017", //standalone , Optional default = 27017
"hosts":[{ //replica
"ip":"127.0.0.1",
"port":"10000"
},{
"ip":"127.0.0.1"
}],
"replicaSet": "$replicaSet", //Optional
"db": "dbname",
"auth":{
"user":"$user",
"pwd":"$pwd"
},
"SRV": false , //optional true/false, default = false
"max_retry": 0,
"timeout": 4,
"retry_condition": "CONNECTION_ERROR",
"connection_string" : {
"reconnectInterval": 10000,
"connectTimeoutMS": 10000
}
}
},
"redis": {
"default": {
"conn_type": "redis",
"host": "127.0.0.1",
"port": "6379",
"max_retry": 0,
"timeout": 5,
"retry_condition": "CONNECTION_ERROR"
}
}
},
"commonLog": {
"projectName": "example",
"log": {
"path": "./logs/appLog/",
"level": "debug",
"console": true,
"file": false,
"time": 15
},
"clog":[{
"name":"refName",
"fileName" : "reportA",
"fileExt" : "rpd",
"file": true,
"time": 15,
"path": "./logs/cLog/"
}],
"summary": {
"path": "./logs/summary/",
"console": true,
"file": false,
"time ": 15,
"format": "json"
},
"detail": {
"path": "./logs/detail/",
"console": true,
"file": false,
"time": 15,
"raw_data": true
},
"stat": {
"time": 15,
"path": "./logs/statPath/",
"console": true,
"file": false,
"mode": 1,
"statInterval": 15,
"flush": false
}
}
}
Change Log
[HISTORY]
1.1.7, 1.1.8
change validate ip
1.1.9
add this.utils().http().isError($resp)
add this.utils().submodules($submodulesName).modules($functionName);
1.1.10
add conn_type "redis"
1.1.11
add this.commonLogAsync($req, $cmd, $identity)
add shortcut this.commonLog() AND this.commonLogAsync() instance of this.commonLog(req) AND this.commonLogAsync(req)
add await this.waitFinished();
1.1.12
add this.utils().schemas($schemaName)
1.1.13, 1.1.14
fix, call logger.close() before stop server
1.1.15, 1.1.16
add http service add code ECONNREFUSED to case connect error
1.1.17
fix bug http timout
1.1.18,1.1.19
fix call log detail end()
1.1.20, 1.1.21
do not call obtainSession case get metrics
1.2.0
-add conf/config.json.append_header_resp to force add http header response
-support openAPI3.0.0(path conf/spec.yaml)
-add env.server.api_docs (true or false) to enable/disable openAPI (default true)
1.2.1
-handle resp EAI_AGAIN for http service
1.2.2, 1.2.3
-fix jest error case openAPI
1.2.4
-fix bug http retry T/O with error end() twice
1.2.5
-log detail write resp with wrong Event.commandName
1.3.0, 1.3.1
-Fix case Socket had closed before send the response message
1.3.2
-Fix case write null body in outgoing response on appLog
1.3.3
-Support add detailLog with responseType arrayBuffer
1.3.4, 1.3.5
-Support hide credentails log
1.3.6
-Support conn_type smtp
1.3.7
-update commonlog-kb for new dateformat
1.3.8
-fix detailLog.input.event
[1.3.9] - 2021-02-10
set default https ciphers
Added
- env.server.https_options
- set default 6 ciphers to https_options
Changed
Fixed
[1.3.10] - 2021-02-16
set default https ciphers
Added
Changed
set default ciphers to https_options
"AES128-SHA256",
"AES256-SHA256",
"AES128-GCM-SHA256",
"AES256-GCM-SHA384",
"ECDHE-RSA-AES256-GCM-SHA384",
"ECDHE-RSA-AES128-GCM-SHA256",
"ECDHE-ECDSA-AES128-GCM-SHA256",
"ECDHE-ECDSA-AES256-GCM-SHA384",
"DHE-RSA-AES128-GCM-SHA256",
"DHE-DSS-AES128-GCM-SHA256",
"ECDHE-RSA-AES128-SHA256",
"ECDHE-ECDSA-AES128-SHA256",
"ECDHE-RSA-AES256-SHA384",
"ECDHE-ECDSA-AES256-SHA384",
"DHE-RSA-AES128-SHA256",
"DHE-RSA-A"
Fixed
[1.3.11] - 2021-02-22
Support connect mongodb replicaSet
Added
add pm2.env.service.mongo.default.replicaSet add pm2.env.service.mongo.default.hosts
Changed
Fixed
[1.4.0] - 2021-03-11
support commonlog 2.3.0
Added
add this.clog("refname", "log log log");
Changed
Fixed
[1.5.0] - 2021-07-09
add feature http request queue
Added
env.server.maxGlobalQueue = 1000
env.server.maxSessionQueue = 10
app.correlateQueue = function(req, res){
return $correlateQueue;
}
Changed
Fixed
[1.5.1, 1.5.2, 1.5.3] - 2021-07-16
add feature http request queue (Support Multiple queue LVL)
Added
Changed
//SINGLE
app.correlateQueue = function(req, res){
return $correlateQueue;
}
OR
//MULTIPLE LVL
app.correlateQueue = [function(req, res){
return $correlateQueueLVL1;
},function(req, res){
return $correlateQueueLVL2;
}]
Fixed
[1.5.4] - 2021-07-23
Allowed this keyword for app.correlateQueue
Added
app.correlateQueue = function(req, res){
//this.debug("log");
return $correlateQueue;
}
Changed
Fixed
[1.5.5] - 2021-08-01
Handle case PayloadTooLargeError(request body size bigger than pm2.commonRod.body_parser_limit)
Handle Throw error from module
Added
Changed
Fixed
Changed
Fixed
[1.5.6] - 2021-09-08
Handle case axios.defaults.transformResponse axios version 0.21.4
Added
Changed
Fixed
[1.5.7] - 2021-12-03
Added
add mongo utils to get db
//example
let db = this.utils().mongo().getDb();
Changed
Fixed
[1.6.0] - 2021-12-07
Added
Changed
change validator for mongo connection
allow config ip,port OR host[].ip, host[].port
Fixed
[1.6.1] - 2021-02-14
Added
Changed
Fixed
add error code 'ENETUNREACH' to http request error
[1.7.0] - 2022-03-02
Added
support config hideCredenmtial with object OR array
Example
foo.bar
foo.bar[]
foo[].bar[]
foo[0].bar[0]
Changed
Fixed
[1.7.1] - 2022-03-11
Added
Changed
Fixed
Fix bug hideCredenmtial with nested object
[1.7.2] - 2022-10-03
Added
Changed
Fixed
Fix bug hideCredenmtial with oher ctype
Fix DetailLog input response attribure Data
[1.7.3] - 2023-06-15
Added
- Support mongo connecion with SRV option
- Add applog "URL NOT FOUND"
Changed
Fixed
[1.8.0-1.8.1] - 2023-06-19
Added
upgrade mongo version from 3.x to 4
Changed
Fixed
[1.8.2] - 2023-11-01
Added
Changed
Fixed
fixed insecure Transport: Weak SSL Protocol
fixed Path Manipulation