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                            1x 1x   1x                           1x      
'use strict';
 
/**
 * Runtime configuration schema for @onlineapps/storage-core.
 *
 * Uses @onlineapps/runtime-config for unified priority:
 * 1. Explicit config (passed to constructor)
 * 2. Environment variable
 * 3. Module-owned defaults (from ./defaults.js)
 *
 * IMPORTANT:
 * - MinIO topology is FAIL-FAST: endpoint/port/credentials must be provided.
 */
 
const { createRuntimeConfig } = require('@onlineapps/runtime-config');
const DEFAULTS = require('./defaults');
 
const runtimeCfg = createRuntimeConfig({
  defaults: DEFAULTS,
  schema: {
    endPoint: { env: 'MINIO_ENDPOINT', required: true },
    port: { env: 'MINIO_PORT', required: true, type: 'number' },
    useSSL: { env: 'MINIO_USE_SSL', default: false, type: 'boolean' },
    accessKey: { env: 'MINIO_ACCESS_KEY', required: true },
    secretKey: { env: 'MINIO_SECRET_KEY', required: true },
 
    // Optional: redirect actual requests to a different host while keeping signature endpoint
    actualHost: { env: 'MINIO_ACTUAL_HOST' },
  }
});
 
module.exports = runtimeCfg;