@@ -8,40 +8,29 @@ const uuid = require('uuid');
88function setup ( options ) {
99 options = options || { } ;
1010 app . locals . app_name = options . APP_NAME || 'sync-wrap' ;
11- app . locals . upstream = new URL ( options . UPSTREAM || "http://localhost" ) ;
11+ app . locals . upstream = new URL ( options . UPSTREAM || "http://localhost:9003 " ) ;
1212 app . locals . version_info = JSON . parse ( options . VERSION_INFO || '{}' ) ;
1313 app . locals . base_path = app . locals . upstream . pathname === "/" ? "" : app . locals . upstream . pathname ;
1414 log . setLevel ( options . LOG_LEVEL || "info" ) ;
1515 app . locals . allow_insecure = ( options . ALLOW_INSECURE || "false" ) === "true" ;
1616 app . locals . unbotli = ( options . UNBOTLI || "false" ) === "true" ;
1717 app . locals . max_sleep = parseFloat ( options . MAX_SLEEP || 5 ) ;
1818 app . locals . default_syncwait = parseFloat ( options . DEFAULT_SYNCWAIT || 5 ) ;
19- let keepalive = ( options . KEEPALIVE || "true" ) === "true" ;
2019
2120 let https = app . locals . upstream . protocol === "https:" ;
2221
22+ app . locals . conn = https ? require ( "https" ) : require ( "http" ) ;
2323
2424 let default_options = {
2525 host : app . locals . upstream . hostname ,
2626 port : app . locals . upstream . port
2727 } ;
2828
29- if ( keepalive ) {
30- let Agent = https ? require ( "agentkeepalive" ) . HttpsAgent : require ( "agentkeepalive" ) ;
31- default_options . agent = new Agent ( {
32- maxSockets : 1000 ,
33- maxFreeSockets : 100 ,
34- timeout : 900000 , // active socket keepalive for 15 mins ?
35- freeSocketTimeout : 30000 // free socket keepalive for 30 seconds
36- } ) ;
37- }
38-
3929 if ( app . locals . allow_insecure ) {
4030 default_options . rejectUnauthorized = false ;
4131 }
4232
4333 app . locals . default_options = default_options ;
44- app . locals . conn = https ? require ( "https" ) : require ( "http" ) ;
4534
4635 log . info ( JSON . stringify ( {
4736 timestamp : Date . now ( ) ,
@@ -109,11 +98,6 @@ function after_request(req, res, next) {
10998 version : app . locals . version_info
11099 } ;
111100
112- if ( req . path === "/_status" ) {
113- let agent = req . app . locals . default_options . agent ;
114- log_entry . agent_status = agent . getCurrentStatus ( ) ;
115- }
116-
117101 if ( log . getLevel ( ) < 2 ) {
118102 // debug
119103 log_entry . req . headers = ( req . rawHeaders || [ ] ) . asMultiValue ( ) ;
0 commit comments