1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
19 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
20 | return new (P || (P = Promise))(function (resolve, reject) {
|
21 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
22 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
23 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
24 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
25 | });
|
26 | };
|
27 | Object.defineProperty(exports, "__esModule", { value: true });
|
28 |
|
29 | const appRoot = require("app-root-path");
|
30 | const cluster = require("cluster");
|
31 | const fg = require("fast-glob");
|
32 | const fs = require("fs-extra");
|
33 | const stringify = require("json-stringify-safe");
|
34 | const _ = require("lodash");
|
35 | const os = require("os");
|
36 | const p = require("path");
|
37 | const semver = require("semver");
|
38 | const globals_1 = require("./globals");
|
39 | const WebSocketLifecycle_1 = require("./internal/transport/websocket/WebSocketLifecycle");
|
40 | const config_1 = require("./internal/util/config");
|
41 | const shutdown_1 = require("./internal/util/shutdown");
|
42 | const string_1 = require("./internal/util/string");
|
43 | const GraphClientFactory_1 = require("./spi/graph/GraphClientFactory");
|
44 | const httpClient_1 = require("./spi/http/httpClient");
|
45 | const wsClient_1 = require("./spi/http/wsClient");
|
46 | const statsdClient_1 = require("./spi/statsd/statsdClient");
|
47 | const logger_1 = require("./util/logger");
|
48 | const packageJson_1 = require("./util/packageJson");
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 | function defaultConfiguration() {
|
57 | const pj = packageJson_1.loadHostPackageJson() || {};
|
58 | pj.name = pj.name || "atm-client-" + string_1.guid();
|
59 | pj.version = pj.version || "0.0.0";
|
60 | pj.keywords = pj.keywords || [];
|
61 | const cfg = loadDefaultConfiguration();
|
62 | cfg.name = pj.name;
|
63 | cfg.version = pj.version;
|
64 | cfg.keywords = pj.keywords;
|
65 | cfg.application = pj.name.replace(/^@.*?\//, "");
|
66 | return cfg;
|
67 | }
|
68 | exports.defaultConfiguration = defaultConfiguration;
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 | function configurationValue(path = "", defaultValue) {
|
77 | if (globals_1.automationClientInstance()) {
|
78 | const conf = globals_1.automationClientInstance().configuration;
|
79 | let value;
|
80 | if (!path || path.length === 0) {
|
81 | value = conf;
|
82 | }
|
83 | else {
|
84 | value = _.get(conf, path);
|
85 | }
|
86 |
|
87 | if (value !== null && value !== undefined) {
|
88 | return value;
|
89 | }
|
90 | }
|
91 | if (defaultValue !== undefined) {
|
92 | return defaultValue;
|
93 | }
|
94 | throw new Error(`Required @Value '${path}' not available`);
|
95 | }
|
96 | exports.configurationValue = configurationValue;
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | function loadDefaultConfiguration() {
|
102 | const cfg = exports.LocalDefaultConfiguration;
|
103 | let envSpecificCfg = {};
|
104 | const nodeEnv = process.env.ATOMIST_ENV || process.env.NODE_ENV;
|
105 | if (nodeEnv === "production") {
|
106 | envSpecificCfg = exports.ProductionDefaultConfiguration;
|
107 | cfgLog("production default");
|
108 | }
|
109 | else if (nodeEnv === "staging" || nodeEnv === "testing") {
|
110 | envSpecificCfg = exports.TestingDefaultConfiguration;
|
111 | cfgLog("testing default");
|
112 | }
|
113 | else if (nodeEnv) {
|
114 | cfg.environment = nodeEnv;
|
115 | }
|
116 |
|
117 | if (process.env.ATOMIST_ENDPOINTS === "staging") {
|
118 | cfg.endpoints = {
|
119 | graphql: "https://automation-staging.atomist.services/graphql/team",
|
120 | api: "https://automation-staging.atomist.services/registration",
|
121 | auth: "https://api-staging.atomist.services/v2/auth",
|
122 | };
|
123 | }
|
124 | return mergeConfigs(cfg, envSpecificCfg);
|
125 | }
|
126 |
|
127 |
|
128 |
|
129 | function userConfigDir() {
|
130 | return p.join(os.homedir(), ".atomist");
|
131 | }
|
132 |
|
133 |
|
134 |
|
135 | function userConfigPath() {
|
136 | const clientConfigFile = "client.config.json";
|
137 | return p.join(userConfigDir(), clientConfigFile);
|
138 | }
|
139 | exports.userConfigPath = userConfigPath;
|
140 |
|
141 |
|
142 |
|
143 |
|
144 | function userConfigPaths() {
|
145 | const configPaths = [userConfigPath()];
|
146 | const profiles = process.env.ATOMIST_CONFIG_PROFILE || process.env.ATOMIST_CONFIG_PROFILES;
|
147 | if (!!profiles) {
|
148 | for (const profile of profiles.split(",")) {
|
149 | configPaths.push(p.join(userConfigDir(), `client.config-${profile}.json`));
|
150 | }
|
151 | }
|
152 | return configPaths;
|
153 | }
|
154 | exports.userConfigPaths = userConfigPaths;
|
155 |
|
156 |
|
157 |
|
158 | function writeUserConfig(cfg) {
|
159 | const cfgDir = userConfigDir();
|
160 | return fs.ensureDir(cfgDir)
|
161 | .then(() => fs.chmod(cfgDir, 0o700))
|
162 | .then(() => fs.writeJson(userConfigPath(), cfg, {
|
163 | spaces: 2,
|
164 | encoding: "utf8",
|
165 | mode: 0o600,
|
166 | }));
|
167 | }
|
168 | exports.writeUserConfig = writeUserConfig;
|
169 |
|
170 |
|
171 |
|
172 | function getUserConfig() {
|
173 | const configPaths = userConfigPaths();
|
174 | const userConfigs = [];
|
175 | for (const configPath of configPaths) {
|
176 | if (fs.existsSync(configPath)) {
|
177 | try {
|
178 | const cfg = fs.readJsonSync(configPath);
|
179 |
|
180 | if (cfg.name) {
|
181 | delete cfg.name;
|
182 | }
|
183 | if (cfg.version) {
|
184 | delete cfg.version;
|
185 | }
|
186 | userConfigs.push(cfg);
|
187 | }
|
188 | catch (e) {
|
189 | e.message = `Failed to read user config: ${e.message}`;
|
190 | throw e;
|
191 | }
|
192 | }
|
193 | }
|
194 | if (userConfigs.length > 0) {
|
195 | return mergeConfigs({}, ...userConfigs);
|
196 | }
|
197 | else {
|
198 | return undefined;
|
199 | }
|
200 | }
|
201 | exports.getUserConfig = getUserConfig;
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 | function cfgLog(source) {
|
208 | if (cluster.isMaster) {
|
209 | logger_1.logger.debug(`Loading configuration '${source}'`);
|
210 | }
|
211 | }
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 | function mergeConfigs(obj, ...sources) {
|
221 | return _.mergeWith(obj, ...sources, (objValue, srcValue) => {
|
222 | if (_.isArray(srcValue)) {
|
223 | return srcValue;
|
224 | }
|
225 | });
|
226 | }
|
227 | exports.mergeConfigs = mergeConfigs;
|
228 |
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 | function deepMergeConfigs(obj, ...sources) {
|
237 | return _.mergeWith(obj, ...sources, (objValue, srcValue) => {
|
238 | if (_.isArray(objValue) && srcValue) {
|
239 | return objValue.concat(srcValue);
|
240 | }
|
241 | });
|
242 | }
|
243 | exports.deepMergeConfigs = deepMergeConfigs;
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 | function resolveModuleConfig(userConfig, name, version) {
|
268 | const cfg = {};
|
269 | if (userConfig) {
|
270 | cfgLog(userConfigPath());
|
271 | const uc = _.cloneDeep(userConfig);
|
272 | let mc = {};
|
273 | if (userConfig.modules) {
|
274 | delete uc.modules;
|
275 | if (name) {
|
276 | let modCfg;
|
277 | const moduleConfigs = userConfig.modules.filter(m => m.name === name);
|
278 | if (version) {
|
279 | modCfg = moduleConfigs.find(m => !m.version || semver.satisfies(version, m.version));
|
280 | }
|
281 | else if (moduleConfigs.length > 0) {
|
282 | modCfg = moduleConfigs[0];
|
283 | }
|
284 | if (modCfg) {
|
285 | cfgLog("module");
|
286 | if (modCfg.name) {
|
287 | delete modCfg.name;
|
288 | }
|
289 | if (modCfg.version) {
|
290 | delete modCfg.version;
|
291 | }
|
292 | mc = modCfg;
|
293 | }
|
294 | }
|
295 | }
|
296 | mergeConfigs(cfg, uc, mc);
|
297 | }
|
298 | return cfg;
|
299 | }
|
300 | exports.resolveModuleConfig = resolveModuleConfig;
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 | function loadUserConfiguration(name, version) {
|
311 | const userConfig = getUserConfig();
|
312 | return resolveModuleConfig(userConfig, name, version);
|
313 | }
|
314 | exports.loadUserConfiguration = loadUserConfiguration;
|
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 |
|
325 |
|
326 | function loadAutomationConfig(configPath) {
|
327 | return __awaiter(this, void 0, void 0, function* () {
|
328 | let cfgPath = configPath;
|
329 | if (!cfgPath) {
|
330 | const cfgFile = "atomist.config.js";
|
331 | const files = yield fg(`${appRoot.path}/**/${cfgFile}`, { ignore: [`${appRoot.path}/**/{.git,node_modules}/**`] });
|
332 | if (files.length === 1) {
|
333 | cfgPath = files[0];
|
334 | }
|
335 | else if (files.length > 1) {
|
336 | throw new Error(`More than one automation configuration found in package: ${files.join(", ")}`);
|
337 | }
|
338 | }
|
339 | if (cfgPath) {
|
340 | try {
|
341 | let cfg = require(cfgPath).configuration;
|
342 | if (cfg instanceof Promise) {
|
343 | cfg = yield cfg;
|
344 | }
|
345 | cfgLog(cfgPath);
|
346 | return cfg;
|
347 | }
|
348 | catch (e) {
|
349 | e.message = `Failed to load ${cfgPath}.configuration: ${e.message}`;
|
350 | throw e;
|
351 | }
|
352 | }
|
353 | return undefined;
|
354 | });
|
355 | }
|
356 | exports.loadAutomationConfig = loadAutomationConfig;
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 | function loadIndexConfig() {
|
364 | return __awaiter(this, void 0, void 0, function* () {
|
365 | const cfgFile = "index.js";
|
366 | const files = yield fg(`${appRoot.path}/**/${cfgFile}`, { ignore: [`${appRoot.path}/**/{.git,node_modules}/**`] });
|
367 | if (files.length > 0) {
|
368 | const cfgs = [];
|
369 | for (const f of files) {
|
370 | try {
|
371 | let cfg = require(f).configuration || {};
|
372 | if (cfg instanceof Promise) {
|
373 | cfg = yield cfg;
|
374 | }
|
375 | cfgLog(f);
|
376 | cfgs.push(cfg);
|
377 | }
|
378 | catch (e) {
|
379 | e.message = `Failed to load ${f}.configuration: ${e.message}`;
|
380 | throw e;
|
381 | }
|
382 | }
|
383 | return deepMergeConfigs({}, ...cfgs);
|
384 | }
|
385 | return {};
|
386 | });
|
387 | }
|
388 | exports.loadIndexConfig = loadIndexConfig;
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 | function loadAtomistConfigPath() {
|
400 | let cfg = {};
|
401 | if (process.env.ATOMIST_CONFIG_PATH) {
|
402 | try {
|
403 | cfg = fs.readJsonSync(process.env.ATOMIST_CONFIG_PATH);
|
404 | cfgLog("ATOMIST_CONFIG_PATH");
|
405 | }
|
406 | catch (e) {
|
407 | e.message = `Failed to read ATOMIST_CONFIG_PATH: ${e.message}`;
|
408 | throw e;
|
409 | }
|
410 | }
|
411 | return cfg;
|
412 | }
|
413 | exports.loadAtomistConfigPath = loadAtomistConfigPath;
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 | function loadAtomistConfig() {
|
426 | let cfg = {};
|
427 | if (process.env.ATOMIST_CONFIG) {
|
428 | try {
|
429 | cfg = JSON.parse(process.env.ATOMIST_CONFIG);
|
430 | cfgLog("ATOMIST_CONFIG");
|
431 | }
|
432 | catch (e) {
|
433 | e.message = `Failed to parse contents of ATOMIST_CONFIG environment variable: ${e.message}`;
|
434 | throw e;
|
435 | }
|
436 | }
|
437 | return cfg;
|
438 | }
|
439 | exports.loadAtomistConfig = loadAtomistConfig;
|
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 |
|
449 |
|
450 | function resolveWorkspaceIds(cfg) {
|
451 | if (process.env.ATOMIST_WORKSPACES) {
|
452 | cfg.workspaceIds = process.env.ATOMIST_WORKSPACES.split(",");
|
453 | }
|
454 | else if (config_1.config("workspaceIds")) {
|
455 | cfg.workspaceIds = config_1.config("workspaceIds");
|
456 | }
|
457 | return cfg.workspaceIds;
|
458 | }
|
459 | exports.resolveWorkspaceIds = resolveWorkspaceIds;
|
460 |
|
461 |
|
462 |
|
463 |
|
464 | function resolvePort(cfg) {
|
465 | if (process.env.PORT) {
|
466 | cfg.http.port = parseInt(process.env.PORT, 10);
|
467 | }
|
468 | return cfg.http.port;
|
469 | }
|
470 | exports.resolvePort = resolvePort;
|
471 | const EnvironmentVariablePrefix = "ATOMIST_";
|
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 | function resolveEnvironmentVariables(cfg) {
|
479 | for (const key in process.env) {
|
480 | if (key.startsWith(EnvironmentVariablePrefix) && process.env.hasOwnProperty(key)) {
|
481 | const cleanKey = key.slice(EnvironmentVariablePrefix.length).split("_").join(".");
|
482 | if (cleanKey[0] !== cleanKey[0].toUpperCase()) {
|
483 | _.update(cfg, cleanKey, () => process.env[key]);
|
484 | }
|
485 | }
|
486 | }
|
487 | }
|
488 | exports.resolveEnvironmentVariables = resolveEnvironmentVariables;
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 | function resolvePlaceholders(cfg, replacer = resolvePlaceholder, visited = [cfg.sdm, cfg.local, cfg.events, cfg.commands, cfg.listeners]) {
|
495 | return __awaiter(this, void 0, void 0, function* () {
|
496 | yield resolvePlaceholdersRecursively(cfg, visited, replacer);
|
497 | });
|
498 | }
|
499 | exports.resolvePlaceholders = resolvePlaceholders;
|
500 | function resolvePlaceholdersRecursively(obj, visited, replacer) {
|
501 | return __awaiter(this, void 0, void 0, function* () {
|
502 | if (!visited.includes(obj)) {
|
503 | visited.push(obj);
|
504 | for (const property in obj) {
|
505 | if (_.has(obj, property)) {
|
506 | if (typeof obj[property] === "object") {
|
507 | yield resolvePlaceholdersRecursively(obj[property], visited, replacer);
|
508 | }
|
509 | else if (typeof obj[property] === "string") {
|
510 | obj[property] = yield replacer(obj[property]);
|
511 | }
|
512 | }
|
513 | }
|
514 | }
|
515 | });
|
516 | }
|
517 | const PlaceholderExpression = /\$\{([.a-zA-Z_-]+)([.:0-9a-zA-Z-_ \" ]+)*\}/g;
|
518 | function resolvePlaceholder(value) {
|
519 | return __awaiter(this, void 0, void 0, function* () {
|
520 | if (!PlaceholderExpression.test(value)) {
|
521 | return value;
|
522 | }
|
523 | PlaceholderExpression.lastIndex = 0;
|
524 | let currentValue = value;
|
525 | let result;
|
526 |
|
527 | while (result = PlaceholderExpression.exec(currentValue)) {
|
528 | const fm = result[0];
|
529 | const envValue = process.env[result[1]];
|
530 | const defaultValue = result[2] ? result[2].trim().slice(1) : undefined;
|
531 | if (envValue) {
|
532 | currentValue = currentValue.split(fm).join(envValue);
|
533 | }
|
534 | else if (defaultValue) {
|
535 | currentValue = currentValue.split(fm).join(defaultValue);
|
536 | }
|
537 | else {
|
538 | throw new Error(`Environment variable '${result[1]}' is not defined`);
|
539 | }
|
540 | }
|
541 | return currentValue;
|
542 | });
|
543 | }
|
544 |
|
545 |
|
546 |
|
547 | function invokePostProcessors(cfg) {
|
548 | return cfg.postProcessors.reduce((pp, fp) => pp.then(fp), Promise.resolve(cfg));
|
549 | }
|
550 | exports.invokePostProcessors = invokePostProcessors;
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 | function validateConfiguration(cfg) {
|
558 | if (!cfg) {
|
559 | throw new Error(`no configuration defined`);
|
560 | }
|
561 | const errors = [];
|
562 | if (!cfg.name) {
|
563 | errors.push("you must set a 'name' property in your configuration");
|
564 | }
|
565 | if (!cfg.version) {
|
566 | errors.push("you must set a 'version' property in your configuration");
|
567 | }
|
568 | if (!cfg.apiKey) {
|
569 | logger_1.logger.info("To obtain an 'apiKey' visit https://app.atomist.com/apikeys and run 'atomist config' " +
|
570 | "to configure the apiKey in your local configuration");
|
571 | errors.push("you must set an 'apiKey' property in your configuration");
|
572 | }
|
573 | cfg.workspaceIds = cfg.workspaceIds || [];
|
574 | cfg.groups = cfg.groups || [];
|
575 | if (cfg.workspaceIds.length < 1 && cfg.groups.length < 1) {
|
576 | errors.push("you must either provide an array of 'groups' in your configuration or, more likely, provide " +
|
577 | "an array of 'workspaceIds' in your configuration or set the ATOMIST_WORKSPACES environment variable " +
|
578 | "to a comma-separated list of workspace IDs");
|
579 | }
|
580 | if (cfg.workspaceIds.length > 0 && cfg.groups.length > 0) {
|
581 | errors.push("you cannot specify both 'workspaceIds' and 'groups' in your configuration, you must set one " +
|
582 | "to an empty array");
|
583 | }
|
584 | if (errors.length > 0) {
|
585 | const msg = `Configuration (${stringify(cfg, string_1.obfuscateJson)}) is not correct: ${errors.join("; ")}`;
|
586 | throw new Error(msg);
|
587 | }
|
588 | }
|
589 | exports.validateConfiguration = validateConfiguration;
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 |
|
613 |
|
614 |
|
615 |
|
616 |
|
617 |
|
618 |
|
619 |
|
620 |
|
621 |
|
622 |
|
623 |
|
624 |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 |
|
635 |
|
636 | function loadConfiguration(cfgPath) {
|
637 | return __awaiter(this, void 0, void 0, function* () {
|
638 |
|
639 | global.__logger = logger_1.logger;
|
640 | let cfg;
|
641 | try {
|
642 | const defCfg = defaultConfiguration();
|
643 | const autoCfg = (yield loadAutomationConfig(cfgPath)) || (yield loadIndexConfig());
|
644 | const userCfg = loadUserConfiguration(defCfg.name, defCfg.version);
|
645 | const atmPathCfg = loadAtomistConfigPath();
|
646 | const atmCfg = loadAtomistConfig();
|
647 | cfg = mergeConfigs({}, defCfg, autoCfg, userCfg, atmPathCfg, atmCfg);
|
648 | resolveWorkspaceIds(cfg);
|
649 | resolvePort(cfg);
|
650 | }
|
651 | catch (e) {
|
652 | e.message = `Failed to load configuration: ${e.message}`;
|
653 | logger_1.logger.error(e.message);
|
654 | if (e.stack) {
|
655 | logger_1.logger.error(`Stack trace:\n${e.stack}`);
|
656 | }
|
657 | throw e;
|
658 | }
|
659 | const completeCfg = yield invokePostProcessors(cfg);
|
660 | completeCfg.postProcessors = [];
|
661 | resolveEnvironmentVariables(completeCfg);
|
662 | yield resolvePlaceholders(completeCfg);
|
663 | validateConfiguration(completeCfg);
|
664 | return completeCfg;
|
665 | });
|
666 | }
|
667 | exports.loadConfiguration = loadConfiguration;
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 |
|
674 |
|
675 | exports.DEFAULT_REDACTION_PATTERNS = [
|
676 | {
|
677 | regexp: /\b[A-F0-9]{64}\b/g,
|
678 | replacement: "[ATOMIST_API_KEY]",
|
679 | },
|
680 | {
|
681 | regexp: /[1-9][0-9]+-[0-9a-zA-Z]{40}/g,
|
682 | replacement: "[TWITTER_ACCESS_TOKEN]",
|
683 | },
|
684 | {
|
685 | regexp: /EAACEdEose0cBA[0-9A-Za-z]+/g,
|
686 | replacement: "[FACEBOOK_ACCESS_TOKEN]",
|
687 | },
|
688 | {
|
689 | regexp: /AIza[0-9A-Za-z\-_]{35}/g,
|
690 | replacement: "[GOOGLE_API_KEY]",
|
691 | },
|
692 | {
|
693 | regexp: /[0-9]+-[0-9A-Za-z_]{32}\.apps\.googleusercontent\.com/g,
|
694 | replacement: "[GOOGLE_OAUTH_ID]",
|
695 | },
|
696 | {
|
697 | regexp: /sk_live_[0-9a-z]{32}/g,
|
698 | replacement: "[PICATIC_API_KEY|",
|
699 | },
|
700 | {
|
701 | regexp: /sk_live_[0-9a-zA-Z]{24}/g,
|
702 | replacement: "[STRIPE_REGULAR_API_KEY]",
|
703 | },
|
704 | {
|
705 | regexp: /rk_live_[0-9a-zA-Z]{24}/g,
|
706 | replacement: "[STRIPE_RESTRICTED_API_KEY]",
|
707 | },
|
708 | {
|
709 | regexp: /sq0atp-[0-9A-Za-z\-_]{22}/g,
|
710 | replacement: "[SQUARE_OAUTH_TOKEN]",
|
711 | },
|
712 | {
|
713 | regexp: /sq0csp-[0-9A-Za-z\-_]{43}/g,
|
714 | replacement: "[SQUARE_OAUTH_SECRET]",
|
715 | },
|
716 | {
|
717 | regexp: /access_token\$production\$[0-9a-z]{16}\$[0-9a-f]{32}/g,
|
718 | replacement: "[BRAINTREE_ACCESS_TOKEN]",
|
719 | },
|
720 | {
|
721 | regexp: /amzn\.mws\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g,
|
722 | replacement: "[AMAZON_AUTH_TOKEN]",
|
723 | },
|
724 | {
|
725 | regexp: /SK[0-9a-fA-F]{32}/g,
|
726 | replacement: "[TWILLIO_API_KEY]",
|
727 | },
|
728 | {
|
729 | regexp: /key-[0-9a-zA-Z]{32}/g,
|
730 | replacement: "[MAILGUN_KEY]",
|
731 | },
|
732 | {
|
733 | regexp: /[0-9a-f]{32}-us[0-9]{1,2}/g,
|
734 | replacement: "[MAILCHIMP_API_KEY]",
|
735 | },
|
736 | {
|
737 | regexp: /\bAK[0-9A-Z]{18}\b/g,
|
738 | replacement: "[AMAZON_ACCESS_KEY]",
|
739 | },
|
740 | {
|
741 | regexp: /\b(https?:\/\/)(?:v1\.)?[a-f0-9]{40}((?::x-oauth-basic)?@)/g,
|
742 | replacement: "$1[GITHUB_TOKEN]$2",
|
743 | },
|
744 | {
|
745 |
|
746 |
|
747 | regexp: /\b((?:ht|f|sm)tps?:\/\/[^:/?#\[\]@""<>{}|\\^``\s]+:)[^:/?#\[\]@""<>{}|\\^``\s]+@/g,
|
748 | replacement: "$1[URL_PASSWORD]@",
|
749 | },
|
750 | ];
|
751 |
|
752 |
|
753 |
|
754 |
|
755 | exports.LocalDefaultConfiguration = {
|
756 | workspaceIds: [],
|
757 | groups: [],
|
758 | environment: "local",
|
759 | policy: "ephemeral",
|
760 | endpoints: {
|
761 | api: "https://automation.atomist.com/registration",
|
762 | graphql: "https://automation.atomist.com/graphql/team",
|
763 | auth: "https://api.atomist.com/v2/auth",
|
764 | },
|
765 | http: {
|
766 | enabled: true,
|
767 | host: "0.0.0.0",
|
768 | auth: {
|
769 | basic: {
|
770 | enabled: false,
|
771 | },
|
772 | bearer: {
|
773 | enabled: false,
|
774 | },
|
775 | },
|
776 | customizers: [],
|
777 | client: {
|
778 | factory: httpClient_1.DefaultHttpClientFactory,
|
779 | },
|
780 | },
|
781 | ws: {
|
782 | enabled: true,
|
783 | client: {
|
784 | factory: wsClient_1.DefaultWebSocketFactory,
|
785 | },
|
786 | termination: {
|
787 | graceful: false,
|
788 | gracePeriod: shutdown_1.defaultGracePeriod,
|
789 | },
|
790 | compress: false,
|
791 | timeout: 30000,
|
792 | lifecycle: new WebSocketLifecycle_1.QueuingWebSocketLifecycle(),
|
793 | },
|
794 | graphql: {
|
795 | client: {
|
796 | factory: GraphClientFactory_1.DefaultGraphClientFactory,
|
797 | },
|
798 | },
|
799 | applicationEvents: {
|
800 | enabled: false,
|
801 | },
|
802 | cluster: {
|
803 | enabled: false,
|
804 | },
|
805 | logging: {
|
806 | level: "info",
|
807 | file: {
|
808 | enabled: true,
|
809 | level: "debug",
|
810 | },
|
811 | banner: {
|
812 | enabled: true,
|
813 | contributors: [],
|
814 | },
|
815 | },
|
816 | statsd: {
|
817 | enabled: false,
|
818 | client: {
|
819 | factory: statsdClient_1.DefaultStatsDClientFactory,
|
820 | },
|
821 | },
|
822 | redact: {
|
823 | log: true,
|
824 | messages: true,
|
825 | patterns: exports.DEFAULT_REDACTION_PATTERNS,
|
826 | },
|
827 | commands: undefined,
|
828 | events: undefined,
|
829 | ingesters: [],
|
830 | listeners: [],
|
831 | postProcessors: [],
|
832 | };
|
833 |
|
834 |
|
835 |
|
836 | exports.ProductionDefaultConfiguration = {
|
837 | environment: "production",
|
838 | policy: "durable",
|
839 | http: {
|
840 | port: 2866,
|
841 | auth: {
|
842 | basic: {
|
843 | enabled: true,
|
844 | },
|
845 | bearer: {
|
846 | enabled: true,
|
847 | },
|
848 | },
|
849 | },
|
850 | ws: {
|
851 | termination: {
|
852 | graceful: true,
|
853 | },
|
854 | compress: true,
|
855 | },
|
856 | applicationEvents: {
|
857 | enabled: true,
|
858 | },
|
859 | cluster: {
|
860 | enabled: true,
|
861 | },
|
862 | logging: {
|
863 | level: "info",
|
864 | file: {
|
865 | enabled: false,
|
866 | },
|
867 | },
|
868 | statsd: {
|
869 | enabled: true,
|
870 | },
|
871 | };
|
872 |
|
873 |
|
874 |
|
875 | exports.TestingDefaultConfiguration = {
|
876 | environment: "testing",
|
877 | policy: "durable",
|
878 | http: {
|
879 | auth: {
|
880 | basic: {
|
881 | enabled: true,
|
882 | },
|
883 | bearer: {
|
884 | enabled: true,
|
885 | },
|
886 | },
|
887 | },
|
888 | ws: {
|
889 | termination: {
|
890 | graceful: true,
|
891 | },
|
892 | compress: true,
|
893 | },
|
894 | applicationEvents: {
|
895 | enabled: true,
|
896 | },
|
897 | cluster: {
|
898 | enabled: true,
|
899 | },
|
900 | logging: {
|
901 | level: "info",
|
902 | file: {
|
903 | enabled: false,
|
904 | },
|
905 | },
|
906 | statsd: {
|
907 | enabled: true,
|
908 | },
|
909 | };
|
910 |
|
\ | No newline at end of file |