Stop listening when an events client disconnects; warn on partial OAuth setup
- Detach the events stream from the queue on the response's close event, which fires when the client goes away whatever the Node version. - Log a warning when only some of the Discord login variables are set, instead of silently leaving the login disabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a269824e2a
commit
8cf0a8eb5b
3 changed files with 17 additions and 1 deletions
|
|
@ -49,6 +49,13 @@ const webPublicUrl = process.env.WEB_PUBLIC_URL?.trim().replace(/\/+$/, "") || n
|
|||
const sessionSecret = process.env.SESSION_SECRET?.trim() || null;
|
||||
const discordOAuthEnabled = Boolean(discordClientSecret && webPublicUrl && sessionSecret);
|
||||
|
||||
const oauthVariablesSet = [discordClientSecret, webPublicUrl, sessionSecret].filter(Boolean).length;
|
||||
if (oauthVariablesSet > 0 && !discordOAuthEnabled) {
|
||||
console.warn(
|
||||
"Connexion avec Discord désactivée : DISCORD_CLIENT_SECRET, WEB_PUBLIC_URL et SESSION_SECRET doivent toutes être définies"
|
||||
);
|
||||
}
|
||||
|
||||
if (discordOAuthEnabled) {
|
||||
let publicUrl;
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue