import { config } from "dotenv"
import { NextResponse } from "next/server"

import { env } from "@/env/server"

import type { NextRequest } from "next/server"

config({ debug: true, override: true })

export async function GET(request: NextRequest) {
  const e = process.env
  console.log({ process_env: process.env })

  const urlVar = "PUBLIC_URL"
  const nextAuthUrlVar = "NEXTAUTH_URL"
  const nextAuthUrlVar2 = "AUTH_URL"
  const envTestVar = "ENVTEST"

  const values = {
    env_url: env.PUBLIC_URL,
    static_url: process.env.PUBLIC_URL,
    dynamic_url: e[urlVar],
    env_envtest: env.ENVTEST,
    static_envtest: process.env.ENVTEST,
    dynamic_envtest: e[envTestVar],
    env_nextauth: env.NEXTAUTH_URL,
    static_nextauth: process.env.NEXTAUTH_URL,
    dynamic_nextauth: e[nextAuthUrlVar],
    env_nextauth2: env.AUTH_URL,
    static_nextauth2: process.env.AUTH_URL,
    dynamic_nextauth2: e[nextAuthUrlVar2],
  }

  console.log(values)

  return NextResponse.json(values)
}
