#!/usr/bin/env tsx
import { config as dotenvConfig } from 'dotenv'
import { resolve, dirname } from 'path'
import { fileURLToPath } from 'url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const envPath = resolve(__dirname, '../../.env')

console.log('Loading .env from:', envPath)
const result = dotenvConfig({ path: envPath })

console.log('dotenv result:', result.error ? result.error.message : 'success')
console.log('PAYLOAD_SECRET:', process.env.PAYLOAD_SECRET ? 'SET' : 'NOT SET')
console.log('DATABASE_URI:', process.env.DATABASE_URI ? 'SET' : 'NOT SET')
