@@ -6,16 +6,24 @@ const GitlabStrategy = require('passport-gitlab2').Strategy
66const config = require ( '../../../config' )
77const response = require ( '../../../response' )
88const { setReturnToFromReferer, passportGeneralCallback } = require ( '../utils' )
9+ const HttpsProxyAgent = require ( 'https-proxy-agent' )
910
1011const gitlabAuth = module . exports = Router ( )
1112
12- passport . use ( new GitlabStrategy ( {
13+ const gitlabAuthStrategy = new GitlabStrategy ( {
1314 baseURL : config . gitlab . baseURL ,
1415 clientID : config . gitlab . clientID ,
1516 clientSecret : config . gitlab . clientSecret ,
1617 scope : config . gitlab . scope ,
1718 callbackURL : config . serverURL + '/auth/gitlab/callback'
18- } , passportGeneralCallback ) )
19+ } , passportGeneralCallback )
20+
21+ if ( process . env [ 'https_proxy' ] ) {
22+ const httpsProxyAgent = new HttpsProxyAgent ( process . env [ 'https_proxy' ] )
23+ gitlabAuthStrategy . _oauth2 . setAgent ( httpsProxyAgent )
24+ }
25+
26+ passport . use ( gitlabAuthStrategy )
1927
2028gitlabAuth . get ( '/auth/gitlab' , function ( req , res , next ) {
2129 setReturnToFromReferer ( req )
0 commit comments