Skip to content

Commit

Permalink
Remove t3 env (#2272)
Browse files Browse the repository at this point in the history
  • Loading branch information
omfj authored Sep 25, 2024
1 parent 67bc0c7 commit e26d1b0
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 62 deletions.
2 changes: 0 additions & 2 deletions apps/web/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import "./src/env.mjs";

/** @type {import("next").NextConfig} */
const config = {
transpilePackages: [
Expand Down
3 changes: 1 addition & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"build": "pnpm run with-env next build",
"dev": "pnpm run with-env next dev",
"lint": "SKIP_ENV_VALIDATION=1 next lint",
"lint": "next lint",
"start": "pnpm run with-env next start",
"clean": "rm -rf .next .turbo node_modules",
"test:unit": "env TZ=UTC-1 vitest",
Expand Down Expand Up @@ -35,7 +35,6 @@
"@radix-ui/react-toast": "1.2.1",
"@sanity/client": "6.21.3",
"@sanity/image-url": "1.0.2",
"@t3-oss/env-nextjs": "0.11.1",
"@tanstack/react-query": "^5.56.2",
"@types/remove-markdown": "0.3.4",
"@vercel/analytics": "1.3.1",
Expand Down
17 changes: 0 additions & 17 deletions apps/web/src/env.mjs

This file was deleted.

5 changes: 2 additions & 3 deletions apps/web/src/lib/checks/with-basic-auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { headers } from "next/headers";
import { type NextRequest } from "next/server";

import { env } from "@/env.mjs";
import { type HandlerFunction } from "./utils";

/**
Expand All @@ -13,12 +12,12 @@ import { type HandlerFunction } from "./utils";
*/
export const withBasicAuth = (handler: HandlerFunction) => {
return async (request: NextRequest): Promise<Response> => {
if (env.NODE_ENV !== "development") {
if (process.env.NODE_ENV !== "development") {
const auth = headers().get("Authorization")?.split(" ")[1];
const decodedAuth = Buffer.from(auth ?? "", "base64").toString();
const [, password] = decodedAuth.split(":");

if (password !== env.ADMIN_KEY) {
if (password !== process.env.ADMIN_KEY) {
return new Response("Unauthorized", {
status: 401,
});
Expand Down
5 changes: 2 additions & 3 deletions apps/web/src/lib/checks/with-bearer-auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { type NextRequest } from "next/server";

import { env } from "@/env.mjs";
import { type HandlerFunction } from "./utils";

/**
Expand All @@ -12,10 +11,10 @@ import { type HandlerFunction } from "./utils";
*/
export const withBearerAuth = (handler: HandlerFunction) => {
return async (request: NextRequest): Promise<Response> => {
if (env.NODE_ENV !== "development") {
if (process.env.NODE_ENV !== "development") {
const auth = request.headers.get("Authorization")?.split(" ")[1];

if (auth !== env.ADMIN_KEY) {
if (auth !== process.env.ADMIN_KEY) {
return new Response("Unauthorized", {
status: 401,
});
Expand Down
34 changes: 0 additions & 34 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"FEIDE_CLIENT_SECRET",
"ADMIN_KEY",
"NEXT_PUBLIC_SANITY_DATASET",
"SKIP_ENV_VALIDATION",
"TESTING",
"VERCEL",
"VERCEL_URL",
Expand Down

0 comments on commit e26d1b0

Please sign in to comment.