UNPKG

@catladder/cli

Version:

Panter cli tool for cloud CI/CD and DevOps

37 lines 1.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getEnvironmentContext = void 0; const BashExpression_1 = require("../bash/BashExpression"); const getEnvConfig_1 = require("./getEnvConfig"); const getEnvType_1 = require("./getEnvType"); const getReviewSlug_1 = require("./getReviewSlug"); const getEnvironmentSlugPrefix = (env, reviewSlug) => { if (reviewSlug) { return (0, BashExpression_1.joinBashExpressions)([env, reviewSlug], "-"); } return env; }; const getEnvironmentContext = ({ env, componentName, config, pipelineType, }) => { const envConfigRaw = (0, getEnvConfig_1.getEnvConfig)(config, componentName, env); const envType = (0, getEnvType_1.getEnvType)(env, envConfigRaw); const reviewSlug = (0, getReviewSlug_1.getReviewSlug)(envConfigRaw, env, pipelineType); const environmentSlugPrefix = getEnvironmentSlugPrefix(env, reviewSlug); const environmentSlug = environmentSlugPrefix.concat(`-${componentName}`); const fullName = (0, BashExpression_1.joinBashExpressions)([config.customerName, config.appName, environmentSlug], "-"); return { envConfigRaw, deployConfigRaw: envConfigRaw.deploy, buildConfigRaw: envConfigRaw.build, environmentSlugPrefix, environmentSlug, reviewSlug, pipelineType, fullName, envType, componentName, env, fullConfig: config, }; }; exports.getEnvironmentContext = getEnvironmentContext; //# sourceMappingURL=getEnvironmentContext.js.map