All files config.js

100% Statements 4/4
100% Branches 0/0
100% Functions 0/0
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45                          1x 1x           1x                                           1x    
'use strict';
 
/**
 * Runtime configuration schema for @onlineapps/conn-base-hub.
 *
 * Uses @onlineapps/runtime-config for unified priority:
 * 1. Explicit config
 * 2. Environment variable (if applicable)
 * 3. Owner defaults (from ./defaults.js)
 *
 * @module @onlineapps/conn-base-hub/config
 */
 
const { createRuntimeConfig } = require('@onlineapps/runtime-config');
const DEFAULTS = require('./defaults');
 
/**
 * Runtime config schema for Hub
 * Flat keys are used for simplicity (nested defaults are accessed via inline defaults)
 */
const runtimeCfg = createRuntimeConfig({
  defaults: {},
  schema: {
    // Infrastructure topology (FAIL-FAST when used)
    rabbitmqUrl: { env: 'RABBITMQ_URL', required: true },
 
    minioEndpoint: { env: 'MINIO_ENDPOINT', required: true },
    minioPort: { env: 'MINIO_PORT', required: true, type: 'number' },
    minioAccessKey: { env: 'MINIO_ACCESS_KEY', required: true },
    minioSecretKey: { env: 'MINIO_SECRET_KEY', required: true },
    minioUseSSL: { env: 'MINIO_USE_SSL', default: false, type: 'boolean' },
 
    // MQ defaults
    mqType: { default: DEFAULTS.mq.type },
    mqDefaultServiceQueueSuffix: { default: DEFAULTS.mq.defaultServiceQueueSuffix },
 
    // Workflow defaults
    workflowDefaultServiceQueueSuffix: { default: DEFAULTS.workflow.defaultServiceQueueSuffix },
    workflowCompletedQueue: { default: DEFAULTS.workflow.completedQueue },
  }
});
 
module.exports = runtimeCfg;