diff --git a/.env.example b/.env.example index 2478ecc5..30092d4b 100644 --- a/.env.example +++ b/.env.example @@ -18,6 +18,7 @@ GITHUB_TOKEN_1= GITHUB_TOKEN_2= GITHUB_TOKEN_3= GITHUB_TOKEN_4= +GITHUB_TOKEN_5= # The domain of the website VITE_HOST=http://localhost:8080 diff --git a/src/helpers/domain.ts b/src/helpers/domain.ts index 2cfaa234..c770fa03 100644 --- a/src/helpers/domain.ts +++ b/src/helpers/domain.ts @@ -45,6 +45,7 @@ const parseBackendCredentials = () => { GITHUB_TOKEN_2: z.string(), GITHUB_TOKEN_3: z.string(), GITHUB_TOKEN_4: z.string(), + GITHUB_TOKEN_5: z.string(), SENTRY_DSN: z.string(), }) .parse(process.env); diff --git a/src/server/github-token.ts b/src/server/github-token.ts index 2e7d731f..bbd73703 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 = 4; +const TOKENS = 5; export const getRandomGithubToken = (): string => { const index = Math.ceil(Math.random() * TOKENS); @@ -20,5 +20,9 @@ export const getRandomGithubToken = (): string => { return backendCredentials().GITHUB_TOKEN_4; } + if (index === 5) { + return backendCredentials().GITHUB_TOKEN_5; + } + throw new Error("GitHub token not found"); };