@axway/axway-central-cli
Version:
Manage APIs, services and publish to the Amplify Marketplace
84 lines (76 loc) • 1.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.environments = void 0;
exports.resolve = resolve;
/**
* Environment specific settings.
*
* @type {Object}
*/
const environments = {
dev: {
auth: {
clientId: 'cli-test-public',
realm: 'Broker'
},
registry: {
url: 'http://localhost:8082'
},
title: 'Development'
},
staging: {
auth: {
clientId: 'amplify-cli',
realm: 'Broker'
},
registry: {
url: 'https://registry.axwaytest.net'
},
title: 'Staging'
},
prod: {
auth: {
clientId: 'amplify-cli',
realm: 'Broker'
},
registry: {
url: 'https://registry.platform.axway.com'
},
title: 'Production'
},
preprod: {
auth: {
clientId: 'amplify-cli',
realm: 'Broker'
},
title: 'PreProduction'
}
};
exports.environments = environments;
const mapping = {
development: 'dev',
preprod: 'preprod',
preproduction: 'preprod',
'pre-production': 'preprod',
production: 'prod',
test: 'staging'
};
function resolve(env) {
let environment = 'prod';
if (env) {
if (typeof env !== 'string') {
throw new TypeError('Expected environment to be a string');
}
environment = env.toLowerCase();
environment = mapping[environment] || environment;
if (!environments[environment]) {
throw new Error(`Invalid environment "${env}"`);
}
}
return {
name: environment,
...environments[environment]
};
}