import path from "path";
import dotenv from "dotenv";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const projectRoot = path.dirname(__filename);

dotenv.config({
  path: path.join(projectRoot, ".env")
});

export const config = {
  projectRoot,

  telegramApiId: Number(process.env.TELEGRAM_API_ID || 0),
  telegramApiHash: process.env.TELEGRAM_API_HASH || "",
  telegramSession: process.env.TELEGRAM_SESSION || "",

  adminPassword: process.env.ADMIN_PASSWORD || "",
  port: Number(process.env.PORT || 3000),

  thumbnailDir: path.resolve(
    projectRoot,
    process.env.THUMBNAIL_DIR || "./thumbnails"
  ),

  databaseFile: path.resolve(
    projectRoot,
    process.env.DATABASE_FILE || "./database/models.db"
  )
};
