UNPKG

redis-smq-rest-api

Version:

REST API for RedisSMQ: OpenAPI 3 schema and Swagger UI for managing queues, messages, and consumers.

30 lines 1.03 kB
import { EConsoleLoggerLevel, ERedisConfigClient } from 'redis-smq-common'; export const DEFAULT_PORT = 7210; export const DEFAULT_BASE_PATH = '/'; function normalizePath(path) { const s = path .split('/') .map((i) => i.trim()) .filter((i) => !!i) .join('/'); return `/${s}`; } export function parseConfig(config = {}) { const { apiServer = {}, redis, logger } = config; return { redis: redis ?? { client: ERedisConfigClient.IOREDIS }, apiServer: { port: apiServer.port ?? DEFAULT_PORT, basePath: normalizePath(apiServer.basePath ?? DEFAULT_BASE_PATH), }, logger: { enabled: logger?.enabled || false, options: { includeTimestamp: logger?.options?.includeTimestamp || true, colorize: logger?.options?.colorize || true, logLevel: logger?.options?.logLevel || EConsoleLoggerLevel.INFO, }, }, }; } //# sourceMappingURL=parseConfig.js.map