Browse Source

retrieve OAuth settings from environment variables

Yuki Takei 7 years ago
parent
commit
2fa89300ac
1 changed files with 4 additions and 4 deletions
  1. 4 4
      lib/service/passport.js

+ 4 - 4
lib/service/passport.js

@@ -265,8 +265,8 @@ class PassportService {
 
     debug('GoogleStrategy: setting up..');
     passport.use(new GoogleStrategy({
-      clientId: config.crowi['security:passport-google:clientId'],
-      clientSecret: config.crowi['security:passport-google:clientSecret'],
+      clientId: config.crowi['security:passport-google:clientId'] || process.env.OAUTH_GOOGLE_CLIENT_SECRET,
+      clientSecret: config.crowi['security:passport-google:clientSecret'] || process.env.OAUTH_GOOGLE_CLIENT_SECRET,
       callbackURL: 'http://localhost:3000/passport/google/callback',  //change this
       skipUserProfile: false,
     }, function(accessToken, refreshToken, profile, done) {
@@ -311,8 +311,8 @@ class PassportService {
 
     debug('GitHubStrategy: setting up..');
     passport.use(new GitHubStrategy({
-      clientID: config.crowi['security:passport-github:clientId'],
-      clientSecret: config.crowi['security:passport-github:clientSecret'],
+      clientID: config.crowi['security:passport-github:clientId'] || process.env.OAUTH_GITHUB_CLIENT_ID,
+      clientSecret: config.crowi['security:passport-github:clientSecret'] || process.env.OAUTH_GITHUB_CLIENT_SECRET,
       callbackURL: 'http://localhost:3000/passport/github/callback',  //change this
       skipUserProfile: false,
     }, function(accessToken, refreshToken, profile, done) {