UNPKG

@dot-event/kubes

Version:

dot-event kubernetes operation

66 lines (57 loc) 1.34 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.processYaml = processYaml; var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread")); var _path = require("path"); async function processYaml(path) { const options = this; const { services, yaml } = options; await runProcessor((0, _objectSpread2.default)({}, options, { path, services, yaml })); } async function runProcessor(options) { const { cluster, config, cwd, events, path, props, yaml } = options; const { clusters, pg } = config; const processor = events.get([...props, "operations", "kubes", "processor"]); if (processor) { const { kubesProcessor } = require((0, _path.join)(cwd, processor)); const service = (0, _path.basename)((0, _path.dirname)(path)); const pgId = await events.gcloudConfigPgId({ cluster, pg, service }); return await kubesProcessor((0, _objectSpread2.default)({}, options, { cluster: clusters[cluster], clusterId: cluster, pg: pg[pgId], pgId, service, yaml })); } return yaml; } //# sourceMappingURL=processYaml.js.map