From cdef6ada4c2205228295dfdb3e0dae08054d8bd5 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Tue, 1 Oct 2024 17:15:53 -0400 Subject: [PATCH] It really doesn't matter what the API key is since it's not real. --- .github/workflows/main.yml | 3 +-- src/middleware.ts | 3 --- tests/utils.ts | 5 +---- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 28634f4..1549253 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,6 +37,5 @@ jobs: DB_TEST_HOSTNAME: 127.0.0.1 DB_TEST_USERNAME: root DB_TEST_PASSWORD: root - CDS_API_KEY: ${{ secrets.CDS_API_KEY }} - HASHED_API_KEY: ${{ secrets.HASHED_API_KEY }} + CDS_API_KEY: TEST_API_KEY run: npm run test diff --git a/src/middleware.ts b/src/middleware.ts index 62849b3..001f80e 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -17,9 +17,6 @@ export async function apiKeyMiddleware(req: Request, res: ExpressResponse, next: const key = req.get("Authorization"); const apiKey = key ? await getAPIKey(key) : null; const apiKeyExists = apiKey !== null; - console.log(`key is null: ${key === null}`); - console.log(`key is undefined: ${key === undefined}`); - console.log(`API key exists: ${apiKeyExists}`); if (validOrigin || (apiKeyExists && hasPermission(apiKey, req))) { next(); } else { diff --git a/tests/utils.ts b/tests/utils.ts index bc31b37..f9e68d5 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -74,13 +74,10 @@ export async function syncTables(force=false): Promise { export async function addAPIKey(): Promise { // Set up some basic data that we're going to want const hashedKey = hashAPIKey(process.env.CDS_API_KEY as string); - await APIKey.create({ + return APIKey.create({ hashed_key: hashedKey, client: "Tests", }); - - const keys = await APIKey.findAll(); - console.log(`There are ${keys.length} keys`); } export async function addTestData() {