@axway/axway-central-cli
Version:
Manage APIs, services and publish to the Amplify Marketplace
63 lines (55 loc) • 1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.environments = void 0;
exports.resolve = resolve;
/**
* Environment specific default settings.
*
* @type {Object}
*/
const environments = {
staging: {
baseUrl: 'https://login.axwaytest.net',
platformUrl: 'https://platform.axwaytest.net',
realm: 'Broker'
},
prod: {
baseUrl: 'https://login.axway.com',
platformUrl: 'https://platform.axway.com',
realm: 'Broker'
},
preprod: {
baseUrl: 'https://login.na-us.axwaypreprod.net',
platformUrl: 'https://platform.na-us.axwaypreprod.net',
realm: 'Broker'
}
};
exports.environments = environments;
const mapping = {
dev: 'staging',
development: 'staging',
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]
};
}