import { createServer } from "./scheduler";
import { getLogger } from "./shared/logger";
import { createWorker } from "./worker";
import pack from "../../package.json";
import { Telemetrist } from "./shared/telemetrist";
export async function runQuirrel(config) {
    var _a, _b;
    const logger = getLogger(config.logger);
    const server = await createServer({ ...config, logger });
    const worker = await createWorker({
        ...config,
        enableUsageMetering: !!((_a = config.passphrases) === null || _a === void 0 ? void 0 : _a.length),
        logger,
    });
    if (!config.disableTelemetry) {
        new Telemetrist((_b = config.runningInDocker) !== null && _b !== void 0 ? _b : false).record(`/version/${pack.version}`);
    }
    return {
        server,
        worker,
        httpServer: server.server,
        async close() {
            await Promise.all([server.close(), worker.close()]);
        },
    };
}
//# sourceMappingURL=index.js.map