import {
  loadPoolConfig
} from "./chunk-RHVN6NA7.js";
import {
  tokenKey
} from "./chunk-GYGNEQSC.js";

// runtime/subsystems/jobs/bullmq.config.ts
var BULLMQ_CONNECTION = Symbol.for(tokenKey("jobs", "bullmq-connection"));
var BULLMQ_RESOLVED_CONFIG = Symbol.for(tokenKey("jobs", "bullmq-resolved-config"));
var DEFAULT_REDIS_URL = "redis://localhost:6379";
var DEFAULT_BULL_BOARD_MOUNT = "/admin/queues";
function resolveBullMqConfig(ext) {
  const url = ext?.redis_url ?? process.env.REDIS_URL ?? DEFAULT_REDIS_URL;
  const resolved = {
    connection: { url },
    queuePrefix: ext?.queue_prefix
  };
  if (ext?.bull_board?.enabled) {
    resolved.bullBoard = {
      enabled: true,
      mountPath: ext.bull_board.mount_path ?? DEFAULT_BULL_BOARD_MOUNT
    };
  }
  return resolved;
}
function resolvePoolQueueName(pool, config, poolConfig = loadPoolConfig()) {
  const alias = poolConfig.get(pool)?.queue ?? pool;
  const prefix = config?.queuePrefix;
  return prefix ? `${prefix}:${alias}` : alias;
}

export {
  BULLMQ_CONNECTION,
  BULLMQ_RESOLVED_CONFIG,
  resolveBullMqConfig,
  resolvePoolQueueName
};
//# sourceMappingURL=chunk-I6MVCB5A.js.map