"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadDbUrlEnvVar = void 0;
const dotenv_1 = __importDefault(require("dotenv"));
const zod_1 = require("zod");
const logger_1 = require("./logger");
const loadDbUrlEnvVar = () => {
    try {
        dotenv_1.default.config();
    }
    catch (err) {
        console.error('Failed loading .env', err);
    }
    // only parse the the db URL so that this command can be run without other env vars being set.
    try {
        const envVars = zod_1.z.object({ DATABASE_URL: zod_1.z.string() }).parse(process.env);
        if (!envVars) {
            logger_1.logger.error(`no database_url environment variable was set.`);
        }
        return envVars;
    }
    catch (e) {
        return null;
    }
};
exports.loadDbUrlEnvVar = loadDbUrlEnvVar;
