"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("../shared/tracer")("quirrel-scheduler");
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 { PORT = 9181, REDIS_URL, REDIS_TLS_CA_BASE64, REDIS_TLS_CA_FILE, HOST, PASSPHRASES, RUNNING_IN_DOCKER, DISABLE_TELEMETRY, JWT_PUBLIC_KEY, POSTHOG_API_KEY, } = config;
    const scheduler = await (0, _1.createServer)({
        port: +PORT,
        host: HOST,
        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,
            },
        }),
        passphrases: !!PASSPHRASES ? PASSPHRASES.split(":") : undefined,
        jwtPublicKey: JWT_PUBLIC_KEY,
        runningInDocker: Boolean(RUNNING_IN_DOCKER),
        disableTelemetry: Boolean(DISABLE_TELEMETRY),
        logger: new structured_logger_1.StructuredLogger(),
        postHogApiKey: POSTHOG_API_KEY,
    });
    return {
        teardown: scheduler.close,
    };
});
//# sourceMappingURL=main.js.map