Add fallback when no dev

This commit is contained in:
DefectingCat
2023-03-23 10:42:54 +08:00
parent 64a5ef443f
commit bbfbd0487e
2 changed files with 39 additions and 0 deletions

View File

@ -3,6 +3,8 @@ import { GistsFile } from 'types';
const password = process.env.NEXT_PUBLIC_GITHUB_API;
const host = process.env.NEXT_PUBLIC_GISTS_HOST ?? 'https://api.github.com';
if (!password) throw new Error('No GitHub token detected.')
const octokit = new Octokit({
auth: password,
baseUrl: host,