"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRealClustersConfig = getRealClustersConfig;
const reduce_1 = __importDefault(require("lodash/reduce"));
const ServerFactory_1 = require("./ServerFactory");
function getRealClustersConfig() {
    const { clustersConfigPath } = (0, ServerFactory_1.getApp)().config;
    // eslint-disable-next-line global-require, security/detect-non-literal-require
    const { clusters } = require(clustersConfigPath) || {};
    if (!clusters) {
        throw new Error('Please make sure you have provided correct file ' + clustersConfigPath);
    }
    return {
        clusters: (0, reduce_1.default)(clusters, (acc, item) => {
            acc[item.id] = item;
            return acc;
        }, {}),
    };
}
