@axway/axway-central-cli
Version:
Manage APIs, services and publish to the Amplify Marketplace
112 lines (104 loc) • 4.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.apigeeXTAEnvVarTemplate = exports.apigeeXDAEnvVarTemplate = exports.ApigeeXAgentValues = void 0;
var _types = require("../../../../common/types");
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
/**
* @description Parameters to provide to the Apigee X handlebars templates.
*/
class ApigeeXAgentValues {
constructor() {
_defineProperty(this, "projectId", void 0);
_defineProperty(this, "developerEmailAddress", void 0);
_defineProperty(this, "mode", void 0);
_defineProperty(this, "environment", void 0);
_defineProperty(this, "fileName", void 0);
_defineProperty(this, "metricsFilter", void 0);
_defineProperty(this, "centralConfig", void 0);
_defineProperty(this, "traceabilityConfig", void 0);
this.projectId = "";
this.developerEmailAddress = "";
this.mode = _types.APIGEEXDISCOVERYMODES.PROXY;
this.environment = "";
this.fileName = "";
this.metricsFilter = new _types.ApigeeMetricsFilterConfig(true, []);
this.centralConfig = new _types.CentralAgentConfig();
this.traceabilityConfig = new _types.TraceabilityConfig();
}
}
/**
* @description Generates the ApigeeX TA env vars file.
*/
exports.ApigeeXAgentValues = ApigeeXAgentValues;
const apigeeXTAEnvVarTemplate = () => {
return `# ApigeeX configs
APIGEE_PROJECTID={{projectId}}
APIGEE_DEVELOPEREMAIL={{developerEmailAddress}}
APIGEE_MODE={{mode}}
APIGEE_ENVIRONMENT={{environment}}
APIGEE_AUTHFILEPATH=/keys/{{fileName}}
APIGEE_METRICSFILTER_FILTERMETRICS={{metricsFilter.filterMetrics}}
{{#if metricsFilter.filterMetrics}}
APIGEE_METRICSFILTER_FILTEREDAPIS={{metricsFilter.filteredAPIs}}
{{/if}}
# Amplify Central configs
{{#if traceabilityConfig.usageReportingOffline}}
CENTRAL_USAGEREPORTING_OFFLINE={{traceabilityConfig.usageReportingOffline}}
CENTRAL_ENVIRONMENTID={{centralConfig.environmentId}}
CENTRAL_AGENTNAME={{centralConfig.taAgentName}}
{{else}}
CENTRAL_AGENTNAME={{centralConfig.taAgentName}}
CENTRAL_AUTH_CLIENTID={{centralConfig.dosaAccount.clientId}}
CENTRAL_AUTH_PRIVATEKEY={{centralConfig.dosaAccount.templatePrivateKey}}
CENTRAL_AUTH_PUBLICKEY={{centralConfig.dosaAccount.templatePublicKey}}
CENTRAL_ENVIRONMENT={{centralConfig.environment}}
CENTRAL_ORGANIZATIONID={{centralConfig.orgId}}
CENTRAL_TEAM={{centralConfig.ampcTeamName}}
CENTRAL_REGION={{centralConfig.region}}
{{#compare . traceabilityConfig.protocol "https"}}
TRACEABILITY_PROTOCOL={{traceabilityConfig.protocol}}
{{/compare}}
{{/if}}
# Logging configs
# Define the logging level: info, debug, error
LOG_LEVEL=info
# Specify where to send the log: stdout, file, both
LOG_OUTPUT=stdout
# Define where the log files are written
LOG_FILE_PATH=logs
`;
};
/**
* @description Generates the ApigeeX DA env vars file.
*/
exports.apigeeXTAEnvVarTemplate = apigeeXTAEnvVarTemplate;
const apigeeXDAEnvVarTemplate = () => {
return `# Azure configs
APIGEE_PROJECTID={{projectId}}
APIGEE_DEVELOPEREMAIL={{developerEmailAddress}}
APIGEE_MODE={{mode}}
APIGEE_ENVIRONMENT={{environment}}
APIGEE_AUTHFILEPATH=/keys/{{fileName}}
# Amplify Central configs
CENTRAL_AGENTNAME={{centralConfig.daAgentName}}
CENTRAL_AUTH_CLIENTID={{centralConfig.dosaAccount.clientId}}
CENTRAL_AUTH_PRIVATEKEY={{centralConfig.dosaAccount.templatePrivateKey}}
CENTRAL_AUTH_PUBLICKEY={{centralConfig.dosaAccount.templatePublicKey}}
CENTRAL_ENVIRONMENT={{centralConfig.environment}}
CENTRAL_ORGANIZATIONID={{centralConfig.orgId}}
CENTRAL_TEAM={{centralConfig.ampcTeamName}}
CENTRAL_REGION={{centralConfig.region}}
# Logging configs
# Define the logging level: info, debug, error
LOG_LEVEL=info
# Specify where to send the log: stdout, file, both
LOG_OUTPUT=stdout
# Define where the log files are written
LOG_FILE_PATH=logs
`;
};
exports.apigeeXDAEnvVarTemplate = apigeeXDAEnvVarTemplate;