forked from danny-avila/LibreChat
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Meilisearch error and refactor of the server index.js (danny-avil…
…a#832) * fix meilisearch error at startup * limit the nesting * disable useless console log * fix(indexSync.js): removed redundant searchEnabled * refactor(index.js): moved configureSocialLogins to a new file * refactor(socialLogins.js): removed unnecessary conditional
- Loading branch information
Showing
3 changed files
with
62 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const session = require('express-session'); | ||
const passport = require('passport'); | ||
const { | ||
googleLogin, | ||
githubLogin, | ||
discordLogin, | ||
facebookLogin, | ||
setupOpenId, | ||
} = require('../strategies'); | ||
|
||
const configureSocialLogins = (app) => { | ||
if (process.env.GOOGLE_CLIENT_ID && process.env.GOOGLE_CLIENT_SECRET) { | ||
passport.use(googleLogin()); | ||
} | ||
if (process.env.FACEBOOK_CLIENT_ID && process.env.FACEBOOK_CLIENT_SECRET) { | ||
passport.use(facebookLogin()); | ||
} | ||
if (process.env.GITHUB_CLIENT_ID && process.env.GITHUB_CLIENT_SECRET) { | ||
passport.use(githubLogin()); | ||
} | ||
if (process.env.DISCORD_CLIENT_ID && process.env.DISCORD_CLIENT_SECRET) { | ||
passport.use(discordLogin()); | ||
} | ||
if ( | ||
process.env.OPENID_CLIENT_ID && | ||
process.env.OPENID_CLIENT_SECRET && | ||
process.env.OPENID_ISSUER && | ||
process.env.OPENID_SCOPE && | ||
process.env.OPENID_SESSION_SECRET | ||
) { | ||
app.use( | ||
session({ | ||
secret: process.env.OPENID_SESSION_SECRET, | ||
resave: false, | ||
saveUninitialized: false, | ||
}), | ||
); | ||
app.use(passport.session()); | ||
setupOpenId(); | ||
} | ||
}; | ||
|
||
module.exports = configureSocialLogins; |