Skip to content

Commit

Permalink
It really doesn't matter what the API key is since it's not real.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carifio24 committed Oct 1, 2024
1 parent 042347a commit cdef6ad
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 0 additions & 3 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 1 addition & 4 deletions tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,10 @@ export async function syncTables(force=false): Promise<void> {
export async function addAPIKey(): Promise<APIKey | void> {
// 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() {
Expand Down

0 comments on commit cdef6ad

Please sign in to comment.