@@ -6,16 +6,24 @@ const GitlabStrategy = require('passport-gitlab2').Strategy
6
6
const config = require ( '../../../config' )
7
7
const response = require ( '../../../response' )
8
8
const { setReturnToFromReferer, passportGeneralCallback } = require ( '../utils' )
9
+ const HttpsProxyAgent = require ( 'https-proxy-agent' ) ;
9
10
10
11
const gitlabAuth = module . exports = Router ( )
11
12
12
- passport . use ( new GitlabStrategy ( {
13
+ let gitlabAuthStrategy = new GitlabStrategy ( {
13
14
baseURL : config . gitlab . baseURL ,
14
15
clientID : config . gitlab . clientID ,
15
16
clientSecret : config . gitlab . clientSecret ,
16
17
scope : config . gitlab . scope ,
17
18
callbackURL : config . serverURL + '/auth/gitlab/callback'
18
- } , passportGeneralCallback ) )
19
+ } , passportGeneralCallback )
20
+
21
+ if ( process . env [ 'https_proxy' ] ) {
22
+ let httpsProxyAgent = new HttpsProxyAgent ( process . env [ 'https_proxy' ] ) ;
23
+ gitlabAuthStrategy . _oauth2 . setAgent ( httpsProxyAgent ) ;
24
+ }
25
+
26
+ passport . use ( gitlabAuthStrategy )
19
27
20
28
gitlabAuth . get ( '/auth/gitlab' , function ( req , res , next ) {
21
29
setReturnToFromReferer ( req )
0 commit comments