"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("../shared/tracer")("quirrel-worker");
const _1 = require(".");
const cliWithConfig_1 = require("../../shared/cliWithConfig");
const create_redis_1 = require("../shared/create-redis");
const structured_logger_1 = require("../shared/structured-logger");
(0, cliWithConfig_1.cliWithConfig)(async (config) => {
    const { REDIS_URL, REDIS_TLS_CA_BASE64, REDIS_TLS_CA_FILE, ENABLE_USAGE_METERING, RUNNING_IN_DOCKER, CONCURRENCY, DISABLE_TELEMETRY, INCIDENT_RECEIVER_ENDPOINT, INCIDENT_RECEIVER_PASSPHRASE, ENABLE_SSRF_PREVENTION, POSTHOG_API_KEY, } = config;
    const worker = await (0, _1.createWorker)({
        redisFactory: (0, create_redis_1.createRedisFactory)(REDIS_URL !== null && REDIS_URL !== void 0 ? REDIS_URL : "redis://localhost:6379", {
            tlsCa: {
                base64: REDIS_TLS_CA_BASE64,
                path: REDIS_TLS_CA_FILE,
            },
        }),
        enableUsageMetering: Boolean(ENABLE_USAGE_METERING),
        runningInDocker: Boolean(RUNNING_IN_DOCKER),
        concurrency: Number.parseInt(CONCURRENCY !== null && CONCURRENCY !== void 0 ? CONCURRENCY : "") || 100,
        disableTelemetry: Boolean(DISABLE_TELEMETRY),
        logger: new structured_logger_1.StructuredLogger(),
        enableSSRFPrevention: !!ENABLE_SSRF_PREVENTION,
        postHogApiKey: POSTHOG_API_KEY,
        incidentReceiver: INCIDENT_RECEIVER_ENDPOINT
            ? {
                endpoint: INCIDENT_RECEIVER_ENDPOINT,
                passphrase: INCIDENT_RECEIVER_PASSPHRASE,
            }
            : undefined,
    });
    return {
        teardown: worker.close,
    };
});
//# sourceMappingURL=main.js.map