"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("./shared/tracer")("quirrel");
const _1 = require(".");
const cliWithConfig_1 = require("../shared/cliWithConfig");
const create_redis_1 = require("./shared/create-redis");
(0, cliWithConfig_1.cliWithConfig)(async (config) => {
    const { PORT = 9181, REDIS_URL, REDIS_TLS_CA_BASE64, REDIS_TLS_CA_FILE, HOST, PASSPHRASES, RUNNING_IN_DOCKER, DISABLE_TELEMETRY, INCIDENT_RECEIVER_ENDPOINT, INCIDENT_RECEIVER_PASSPHRASE, ENABLE_SSRF_PREVENTION, JWT_PUBLIC_KEY, POSTHOG_API_KEY, } = config;
    const quirrel = await (0, _1.runQuirrel)({
        port: +PORT,
        host: HOST,
        redisFactory: (0, create_redis_1.createRedisFactory)(REDIS_URL, {
            tlsCa: {
                base64: REDIS_TLS_CA_BASE64,
                path: REDIS_TLS_CA_FILE,
            },
        }),
        passphrases: !!PASSPHRASES ? PASSPHRASES.split(":") : undefined,
        jwtPublicKey: JWT_PUBLIC_KEY,
        runningInDocker: Boolean(RUNNING_IN_DOCKER),
        disableTelemetry: Boolean(DISABLE_TELEMETRY),
        logger: "structured",
        enableSSRFPrevention: !!ENABLE_SSRF_PREVENTION,
        postHogApiKey: POSTHOG_API_KEY,
        incidentReceiver: INCIDENT_RECEIVER_ENDPOINT
            ? {
                endpoint: INCIDENT_RECEIVER_ENDPOINT,
                passphrase: INCIDENT_RECEIVER_PASSPHRASE,
            }
            : undefined,
    });
    return {
        teardown: quirrel.close,
    };
});
//# sourceMappingURL=main.js.map