Skip to content

Commit

Permalink
add AGORA_API_KEY to constants
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadPCh committed Aug 25, 2024
1 parent 1443cb2 commit bd71339
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ export const IMPORT_PROJECT_CRON_SCHEDULE =
export const DESCRIPTION_SUMMARY_LENGTH = Number(
process.env.DESCRIPTION_SUMMARY_LENGTH || 300
);

export const a = assertNotNull(process.env.AGORA_API_KEY);
10 changes: 8 additions & 2 deletions src/features/import-projects/rf/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { AGORA_API_KEY } from "../../../constants";
import { RF_API_URL } from "./constants";
import { saveBatchProjects } from "./helpers";
import { RfApiResponse, RfProjectInfo } from "./type";
Expand All @@ -8,9 +9,14 @@ export const fetchRFProjectsByRound = async (round: number) => {
let hasNext = true;

console.log(
`[${new Date().toISOString()}] - Fetching projects for round: ${round} - ${process.env.AGORA_API_KEY}`
`[${new Date().toISOString()}] - Fetching projects for round: ${round}`
);

if (!AGORA_API_KEY) {
console.error("AGORA_API_KEY is not set");
return;
}

try {
while (hasNext) {
const response = await fetch(
Expand All @@ -19,7 +25,7 @@ export const fetchRFProjectsByRound = async (round: number) => {
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.AGORA_API_KEY}`,
Authorization: `Bearer ${AGORA_API_KEY}`,
},
}
);
Expand Down

0 comments on commit bd71339

Please sign in to comment.