UNPKG

@axway/axway-central-cli

Version:

Manage APIs, services and publish to the Amplify Marketplace

118 lines (111 loc) 4.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.sensediaTAEnvVarTemplate = exports.sensediaDAEnvVarTemplate = exports.SensediaAuthType = exports.SensediaAgentValues = 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); } let SensediaAuthType = exports.SensediaAuthType = /*#__PURE__*/function (SensediaAuthType) { SensediaAuthType["OAuth"] = "OAuth Client ID and Client Secret"; SensediaAuthType["StaticToken"] = "Static Token"; return SensediaAuthType; }({}); /** * @description Parameters to provide to the Sensedia handlebars templates. */ class SensediaAgentValues { constructor() { _defineProperty(this, "baseUrl", void 0); _defineProperty(this, "authType", void 0); _defineProperty(this, "clientId", void 0); _defineProperty(this, "clientSecret", void 0); _defineProperty(this, "authToken", void 0); _defineProperty(this, "developerEmail", void 0); _defineProperty(this, "environments", void 0); _defineProperty(this, "centralConfig", void 0); _defineProperty(this, "traceabilityConfig", void 0); this.baseUrl = ''; this.authType = ''; this.clientId = ''; this.clientSecret = ''; this.authToken = ''; this.developerEmail = ''; this.environments = []; this.centralConfig = new _types.CentralAgentConfig(); this.traceabilityConfig = new _types.TraceabilityConfig(); } } /** * @description Generates the Sensedia TA env vars file. */ exports.SensediaAgentValues = SensediaAgentValues; const sensediaTAEnvVarTemplate = () => { return `# Sensedia configs SENSEDIA_BASEURL={{baseUrl}} {{#if clientId}} SENSEDIA_AUTH_CLIENTID={{clientId}} SENSEDIA_AUTH_CLIENTSECRET={{clientSecret}} {{/if}} {{#if authToken}} SENSEDIA_AUTH_TOKEN={{authToken}} {{/if}} {{#if environments.length}} SENSEDIA_ENVIRONMENTS={{environments}} {{/if}} # Amplify Central configs 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}} # 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 Sensedia DA env vars file. */ exports.sensediaTAEnvVarTemplate = sensediaTAEnvVarTemplate; const sensediaDAEnvVarTemplate = () => { return `# Sensedia configs SENSEDIA_BASEURL={{baseUrl}} {{#if clientId}} SENSEDIA_AUTH_CLIENTID={{clientId}} SENSEDIA_AUTH_CLIENTSECRET={{clientSecret}} {{/if}} {{#if authToken}} SENSEDIA_AUTH_TOKEN={{authToken}} {{/if}} SENSEDIA_DEVELOPEREMAIL={{developerEmail}} {{#if environments.length}} SENSEDIA_ENVIRONMENTS={{environments}} {{/if}} # 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.sensediaDAEnvVarTemplate = sensediaDAEnvVarTemplate;