From 8d941840e57e96370bd9809ffae05ca9ed521ccf Mon Sep 17 00:00:00 2001 From: Jonny Burger Date: Wed, 13 Dec 2023 11:54:50 +0100 Subject: [PATCH] another github token --- .env.example | 3 ++- src/helpers/domain.ts | 1 + src/server/github-token.ts | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 30092d4b..02497230 100644 --- a/.env.example +++ b/.env.example @@ -12,13 +12,14 @@ DB_USER= DISCORD_CHANNEL= DISCORD_TOKEN= -# 4 GitHub tokens for load balancing API requests. +# 6 GitHub tokens for load balancing API requests. # If you have fewer, enter the same multiple times. GITHUB_TOKEN_1= GITHUB_TOKEN_2= GITHUB_TOKEN_3= GITHUB_TOKEN_4= GITHUB_TOKEN_5= +GITHUB_TOKEN_6= # The domain of the website VITE_HOST=http://localhost:8080 diff --git a/src/helpers/domain.ts b/src/helpers/domain.ts index c770fa03..c96ece05 100644 --- a/src/helpers/domain.ts +++ b/src/helpers/domain.ts @@ -46,6 +46,7 @@ const parseBackendCredentials = () => { GITHUB_TOKEN_3: z.string(), GITHUB_TOKEN_4: z.string(), GITHUB_TOKEN_5: z.string(), + GITHUB_TOKEN_6: z.string(), SENTRY_DSN: z.string(), }) .parse(process.env); diff --git a/src/server/github-token.ts b/src/server/github-token.ts index 62d71566..c2d3ffd6 100644 --- a/src/server/github-token.ts +++ b/src/server/github-token.ts @@ -1,6 +1,6 @@ import { backendCredentials } from "../helpers/domain.js"; -const TOKENS = 5; +const TOKENS = 6; let i = 0; @@ -27,5 +27,9 @@ export const getRandomGithubToken = (): string => { return backendCredentials().GITHUB_TOKEN_5; } + if (index === 6) { + return backendCredentials().GITHUB_TOKEN_6; + } + throw new Error("GitHub token not found"); };