"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolvePorts = void 0;
exports.resolvePorts = (services, config, logger, defaultPort = 3001) => {
    logger.log('port').debug('Resolving port from config', config);
    const result = {};
    services.forEach((service) => {
        const name = service.name;
        const inConfig = config.ports[name] != null;
        const port = inConfig ? config.ports[name] : defaultPort;
        if (!inConfig) {
            defaultPort++;
        }
        result[service.name] = port;
    });
    logger.log('port').debug('Ports resolved', result);
    return result;
};
//# sourceMappingURL=resolve-ports.js.map