import path from "node:path";

export const PROXY_SERVER = Deno.env.get("PROXY_SERVER");
export const PROXY_USERNAME = Deno.env.get("PROXY_USERNAME");
export const PROXY_PASSWORD = Deno.env.get("PROXY_PASSWORD");

export const SILVERBULLET_SERVER = Deno.env.get("SILVERBULLET_SERVER");
export const TMDB_API_KEY = Deno.env.get("TMDB_API_KEY");
export const OPENAI_API_KEY = Deno.env.get("OPENAI_API_KEY");
export const YOUTUBE_API_KEY = Deno.env.get("YOUTUBE_API_KEY");

export const GITEA_SERVER = Deno.env.get("GITEA_SERVER");
export const GITEA_CLIENT_ID = Deno.env.get("GITEA_CLIENT_ID")!;
export const GITEA_CLIENT_SECRET = Deno.env.get("GITEA_CLIENT_SECRET");
export const GITEA_REDIRECT_URL = Deno.env.get("GITEA_REDIRECT_URL");

export const DATABASE_URL = Deno.env.get("DATABASE_URL") || "dev.db";

const duration = Deno.env.get("SESSION_DURATION");
export const SESSION_DURATION = duration ? +duration : (60 * 60 * 24);

export const JWT_SECRET = Deno.env.get("JWT_SECRET");

export const DATA_DIR = Deno.env.has("DATA_DIR")
  ? path.resolve(Deno.env.get("DATA_DIR")!)
  : path.resolve(Deno.cwd(), "data");

export const LOG_LEVEL: string = Deno.env.get("LOG_LEVEL") ||
  "warn";
