Skip to content

Commit

Permalink
chore: remove maybe & logger deps from middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
alanrsoares committed Jan 11, 2024
1 parent 4aa376b commit 6502b13
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions apps/maestro/src/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { Maybe } from "@axelarjs/utils";
import { NextResponse, type NextRequest } from "next/server";

import { logger } from "~/lib/logger";

// Limit middleware pathname config
export const config = {
matcher: [
Expand All @@ -19,7 +16,7 @@ export const config = {

export function middleware(req: NextRequest) {
// Extract country
const country = Maybe.of(req.geo?.country).valueOr("US");
const country = req.geo?.country ?? "US";

const isBlocked = BLOCKED_COUNTRIES.includes(country);

Expand All @@ -29,7 +26,7 @@ export function middleware(req: NextRequest) {
}

if (isBlocked) {
logger.always.info("unauthorized_access_attempt:", {
console.info("unauthorized_access_attempt:", {
...(req.geo ?? {}),
ip: req.ip,
userAgent: req.headers.get("user-agent"),
Expand Down

0 comments on commit 6502b13

Please sign in to comment.