UNPKG

26.8 kBJavaScriptView Raw
1"use strict";
2/*
3 * Copyright © 2018 Atomist, Inc.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18Object.defineProperty(exports, "__esModule", { value: true });
19const appRoot = require("app-root-path");
20const cluster = require("cluster");
21const fs = require("fs-extra");
22const glob = require("glob");
23const stringify = require("json-stringify-safe");
24const _ = require("lodash");
25const p = require("path");
26const semver = require("semver");
27const globals_1 = require("./globals");
28const config_1 = require("./internal/util/config");
29const logger_1 = require("./internal/util/logger");
30const string_1 = require("./internal/util/string");
31const axiosHttpClient_1 = require("./spi/http/axiosHttpClient");
32/**
33 * Generate defaults for various configuration option values. These
34 * will only be used if values are not provided by any source. Values
35 * not provided here will be `undefined`.
36 *
37 * @return default configuration
38 */
39function defaultConfiguration() {
40 let pj;
41 try {
42 // tslint:disable-next-line:no-var-requires
43 pj = require(`${appRoot.path}/package.json`);
44 }
45 catch (e) {
46 logger_1.logger.warn(`Failed to load package.json: ${e.message}`);
47 pj = {};
48 }
49 pj.name = pj.name || "atm-client-" + string_1.guid();
50 pj.version = pj.version || "0.0.0";
51 pj.keywords = pj.keywords || [];
52 const cfg = loadDefaultConfiguration();
53 cfg.name = pj.name;
54 cfg.version = pj.version;
55 cfg.keywords = pj.keywords;
56 cfg.application = pj.name.replace(/^@.*?\//, "");
57 return cfg;
58}
59exports.defaultConfiguration = defaultConfiguration;
60/**
61 * Exposes the configuration for lookup of configuration values.
62 * This is useful for components to obtain values eg. from configuration.custom
63 * like user provided secrets etc.
64 * @param {string} path the property path evaluated against the configuration instance
65 * @returns {T}
66 */
67function configurationValue(path, defaultValue) {
68 if (globals_1.automationClientInstance()) {
69 const conf = globals_1.automationClientInstance().configuration;
70 const value = _.get(conf, path);
71 if (value != null) {
72 return value;
73 }
74 else if (defaultValue !== undefined) {
75 return defaultValue;
76 }
77 }
78 else if (defaultValue) {
79 return defaultValue;
80 }
81 throw new Error(`Required @Value '${path}' not available`);
82}
83exports.configurationValue = configurationValue;
84/**
85 * Return the default configuration based on NODE_ENV or ATOMIST_ENV.
86 * ATOMIST_ENV takes precedence if it is set.
87 */
88function loadDefaultConfiguration() {
89 const cfg = exports.LocalDefaultConfiguration;
90 let envSpecificCfg = {};
91 const nodeEnv = process.env.ATOMIST_ENV || process.env.NODE_ENV;
92 if (nodeEnv === "production") {
93 envSpecificCfg = exports.ProductionDefaultConfiguration;
94 }
95 else if (nodeEnv === "staging" || nodeEnv === "testing") {
96 envSpecificCfg = exports.TestingDefaultConfiguration;
97 }
98 else if (nodeEnv) {
99 cfg.environment = nodeEnv;
100 }
101 return mergeConfigs(cfg, envSpecificCfg);
102}
103/**
104 * Return Atomist user configuration directory.
105 */
106function userConfigDir() {
107 const home = process.env[process.platform === "win32" ? "USERPROFILE" : "HOME"];
108 return p.join(home, ".atomist");
109}
110/**
111 * Return user automation client configuration path.
112 */
113function userConfigPath() {
114 const clientConfigFile = "client.config.json";
115 return p.join(userConfigDir(), clientConfigFile);
116}
117exports.userConfigPath = userConfigPath;
118/**
119 * Write user config securely, creating directories as necessary.
120 */
121function writeUserConfig(cfg) {
122 const cfgDir = userConfigDir();
123 return fs.ensureDir(cfgDir)
124 .then(() => fs.chmod(cfgDir, 0o700))
125 .then(() => fs.writeJson(userConfigPath(), cfg, {
126 spaces: 2,
127 encoding: "utf8",
128 mode: 0o600,
129 }));
130}
131exports.writeUserConfig = writeUserConfig;
132/**
133 * Read and return user config from UserConfigFile.
134 */
135function getUserConfig() {
136 if (fs.existsSync(userConfigPath())) {
137 try {
138 const cfg = fs.readJsonSync(userConfigPath());
139 // user config should not have name or version
140 if (cfg.name) {
141 delete cfg.name;
142 }
143 if (cfg.version) {
144 delete cfg.version;
145 }
146 return cfg;
147 }
148 catch (e) {
149 e.message = `Failed to read user config: ${e.message}`;
150 throw e;
151 }
152 }
153 return undefined;
154}
155exports.getUserConfig = getUserConfig;
156/**
157 * Log the loading of a configuration
158 *
159 * @param source name of configuration source
160 */
161function cfgLog(source) {
162 if (cluster.isMaster) {
163 logger_1.logger.debug(`Loading ${source} configuration`);
164 }
165}
166/**
167 * Overwrite values in the former configuration with values in the
168 * latter. The start object is modified.
169 *
170 * @param obj starting configuration
171 * @param override configuration values to add/override those in start
172 * @return resulting merged configuration
173 */
174function mergeConfigs(obj, ...sources) {
175 return _.mergeWith(obj, ...sources, (objValue, srcValue) => {
176 if (_.isArray(srcValue)) {
177 return srcValue;
178 }
179 });
180}
181exports.mergeConfigs = mergeConfigs;
182/**
183 * Merge a user's global and proper per-module configuration, if it
184 * exists. Values from the per-module configuration take precedence
185 * over the user-wide values. Per-module configuration is gotten from
186 * the first per-module configuration that matches name and,
187 * optionally, the version is within the per-module configuration's
188 * version range. A module configuration without a version range
189 * matches the named module with any version. If no version is
190 * provided, any version range is satisfied, meaning the first
191 * per-module configuration with a matching name is used. If no name
192 * is provide, only the user configuration is loaded. The first
193 * per-module match is used. This means if you have multiple
194 * configurations for the same named module and you want to include a
195 * default configuration for that module, put a configuration without
196 * a version range _after_ all the configurations with version ranges.
197 * Note that only values from the first per-module match are used.
198 *
199 * @param userConfig the user's configuration, which may include per-module configuration
200 * @param name automation client package name to load as module config if it exists
201 * @param version automation client package version to load as module config if
202 * version satifies module config version range
203 * @return the merged module and user configuration
204 */
205function resolveModuleConfig(userConfig, name, version) {
206 const cfg = {};
207 if (userConfig) {
208 cfgLog("user");
209 const uc = _.cloneDeep(userConfig);
210 let mc = {};
211 if (userConfig.modules) {
212 delete uc.modules;
213 if (name) {
214 let modCfg;
215 const moduleConfigs = userConfig.modules.filter(m => m.name === name);
216 if (version) {
217 modCfg = moduleConfigs.find(m => !m.version || semver.satisfies(version, m.version));
218 }
219 else if (moduleConfigs.length > 0) {
220 modCfg = moduleConfigs[0];
221 }
222 if (modCfg) {
223 cfgLog("module");
224 if (modCfg.name) {
225 delete modCfg.name;
226 }
227 if (modCfg.version) {
228 delete modCfg.version;
229 }
230 mc = modCfg;
231 }
232 }
233 }
234 mergeConfigs(cfg, uc, mc);
235 }
236 return cfg;
237}
238exports.resolveModuleConfig = resolveModuleConfig;
239/**
240 * Try to read user config, overriding its values with a per-module
241 * configuration that matches this automation.
242 *
243 * @param name automation client package name to load as module config if it exists
244 * @param version automation client package version to load as module config if
245 * version satifies module config version range
246 * @return module-specific config with user config supplying defaults
247 */
248function loadUserConfiguration(name, version) {
249 const userConfig = getUserConfig();
250 return resolveModuleConfig(userConfig, name, version);
251}
252exports.loadUserConfiguration = loadUserConfiguration;
253/**
254 * Load the automation configuration from the configuration object
255 * exported from cfgPath and return it. If no configuration path is
256 * provided, the package will be searched for a file named
257 * atomist.config.js. If no atomist.config.js is found, an empty
258 * object is returned. If more than one is found, an exception is
259 * thrown.
260 *
261 * @param cfgPath location of automation configuration
262 * @return automation configuration
263 */
264function loadAutomationConfig(cfgPath) {
265 let cfg = {};
266 if (!cfgPath) {
267 const cfgFile = "atomist.config.js";
268 const files = glob.sync(`${appRoot.path}/**/${cfgFile}`, { ignore: ["**/{.git,node_modules}/**"] });
269 if (files.length === 1) {
270 cfgPath = files[0];
271 }
272 else if (files.length > 1) {
273 throw new Error(`More than one automation configuration found in package: ${files.join(", ")}`);
274 }
275 }
276 if (cfgPath) {
277 try {
278 cfg = require(cfgPath).configuration;
279 cfgLog("automation config");
280 }
281 catch (e) {
282 e.message = `Failed to load ${cfgPath}.configuration: ${e.message}`;
283 throw e;
284 }
285 }
286 return cfg;
287}
288exports.loadAutomationConfig = loadAutomationConfig;
289/**
290 * Load configuration from the file defined by the ATOMIST_CONFIG_PATH
291 * environment variable, if it the variable is defined and the file
292 * exists, and return it. The contents of the ATOMIST_CONFIG_PATH
293 * file should be serialized JSON of AutomationServerOptions. If the
294 * environment variable is not defined or the file path specified by
295 * its value cannot be read as JSON, an empty object is returned.
296 *
297 * @return automation server options
298 */
299function loadAtomistConfigPath() {
300 let cfg = {};
301 if (process.env.ATOMIST_CONFIG_PATH) {
302 try {
303 cfg = fs.readJsonSync(process.env.ATOMIST_CONFIG_PATH);
304 cfgLog("ATOMIST_CONFIG_PATH");
305 }
306 catch (e) {
307 e.message = `Failed to read ATOMIST_CONFIG_PATH: ${e.message}`;
308 throw e;
309 }
310 }
311 return cfg;
312}
313exports.loadAtomistConfigPath = loadAtomistConfigPath;
314/**
315 * Load configuration from the ATOMIST_CONFIG environment variable, if
316 * it the variable is defined, and merge it into the passed in
317 * configuration. The value of the ATOMIST_CONFIG environment
318 * variable should be serialized JSON of AutomationServerOptions. The
319 * values from the environment variable will override values in the
320 * passed in configuration. If the environment variable is not
321 * defined, the passed in configuration is returned unchanged.
322 *
323 * @return automation server options
324 */
325function loadAtomistConfig() {
326 let cfg = {};
327 if (process.env.ATOMIST_CONFIG) {
328 try {
329 cfg = JSON.parse(process.env.ATOMIST_CONFIG);
330 cfgLog("ATOMIST_CONFIG");
331 }
332 catch (e) {
333 e.message = `Failed to parse contents of ATOMIST_CONFIG environment variable: ${e.message}`;
334 throw e;
335 }
336 }
337 return cfg;
338}
339exports.loadAtomistConfig = loadAtomistConfig;
340/**
341 * Examine environment, config, and cfg for Atomist team IDs. The
342 * ATOMIST_TEAMS environment variable takes precedence over the
343 * ATOMIST_TEAM environment variable, which takes precedence over the
344 * configuration "teamdIds", which takes precedence over cfg.teamIds,
345 * which may be undefined, null, or an empty array.
346 *
347 * @deprecated resolveTeamIds is deprecated and will be removed in a
348 * future release
349 */
350function resolveTeamIds(cfg) {
351 if (process.env.ATOMIST_TEAMS) {
352 cfg.teamIds = process.env.ATOMIST_TEAMS.split(",");
353 }
354 else if (process.env.ATOMIST_TEAM) {
355 cfg.teamIds = [process.env.ATOMIST_TEAM];
356 }
357 else if (config_1.config("teamIds")) {
358 cfg.teamIds = config_1.config("teamIds");
359 }
360 return cfg.teamIds;
361}
362exports.resolveTeamIds = resolveTeamIds;
363/**
364 * Examine environment, config, and cfg for Atomist workspace IDs.
365 * The ATOMIST_WORKSPACES environment variable takes precedence over
366 * the configuration "workspaceIds", which takes precedence over
367 * cfg.workspaceId, which may be undefined, null, or an empty array.
368 * If the ATOMIST_WORKSPACES environment variable is not set,
369 * workspaceIds is not set in config, and workspaceIds is falsey in
370 * cfg and teamIds is resolvable from the configuration, workspaceIds
371 * is set to teamIds.
372 *
373 * @param cfg current configuration, whose workspaceIds and teamIds
374 * properties may be modified by this function
375 * @return the resolved workspace IDs
376 */
377function resolveWorkspaceIds(cfg) {
378 const teamIds = resolveTeamIds(cfg);
379 if (process.env.ATOMIST_WORKSPACES) {
380 cfg.workspaceIds = process.env.ATOMIST_WORKSPACES.split(",");
381 }
382 else if (config_1.config("workspaceIds")) {
383 cfg.workspaceIds = config_1.config("workspaceIds");
384 }
385 else if ((!cfg.workspaceIds || cfg.workspaceIds.length < 1) && teamIds && teamIds.length > 0) {
386 cfg.workspaceIds = teamIds;
387 }
388 return cfg.workspaceIds;
389}
390exports.resolveWorkspaceIds = resolveWorkspaceIds;
391/**
392 * Resolve a value from a environment variables or configuration keys.
393 * The environment variables are checked in order and take precedence
394 * over the configuration key, which are also checked in order. If
395 * no truthy values are found, undefined is returned.
396 *
397 * @param environmentVariables environment variables to check
398 * @param configKeyPaths configuration keys, as JSON paths, to check
399 * @param defaultValue value to use if no environment variables or config keys have values
400 * @return first truthy value found, or defaultValue
401 */
402function resolveConfigurationValue(environmentVariables, configKeyPaths, defaultValue) {
403 for (const ev of environmentVariables) {
404 if (process.env[ev]) {
405 return process.env[ev];
406 }
407 }
408 for (const cv of configKeyPaths) {
409 if (config_1.config(cv)) {
410 return config_1.config(cv);
411 }
412 }
413 return defaultValue;
414}
415exports.resolveConfigurationValue = resolveConfigurationValue;
416/**
417 * Resolve the token from the environment and configuration. The
418 * ATOMIST_TOKEN environment variable takes precedence over the
419 * GITHUB_TOKEN environment variable, which takes precedence over the
420 * config value, which takes precedence over the passed in value.
421 *
422 * @deprecated resolveToken is deprecated and will be removed in a
423 * future release
424 */
425function resolveToken(cfg) {
426 cfg.token = resolveConfigurationValue(["ATOMIST_TOKEN", "GITHUB_TOKEN"], ["token"], cfg.token);
427 return cfg.token;
428}
429exports.resolveToken = resolveToken;
430/**
431 * Resolve the HTTP port from the environment and configuration. The
432 * PORT environment variable takes precedence over the config value.
433 */
434function resolvePort(cfg) {
435 if (process.env.PORT) {
436 cfg.http.port = parseInt(process.env.PORT, 10);
437 }
438 return cfg.http.port;
439}
440exports.resolvePort = resolvePort;
441const EnvironmentVariablePrefix = "ATOMIST_";
442/**
443 * Resolve ATOMIST_ environment variables and add them to config.
444 * Variables of like ATOMIST_custom_foo_bar will be converted to
445 * a json path of custom.foo.bar.
446 * @param {Configuration} cfg
447 */
448function resolveEnvironmentVariables(cfg) {
449 for (const key in process.env) {
450 if (key.startsWith(EnvironmentVariablePrefix)
451 && process.env.hasOwnProperty(key)) {
452 const cleanKey = key.slice(EnvironmentVariablePrefix.length).split("_").join(".");
453 if (cleanKey[0] !== cleanKey[0].toUpperCase()) {
454 _.update(cfg, cleanKey, () => process.env[key]);
455 }
456 }
457 }
458}
459exports.resolveEnvironmentVariables = resolveEnvironmentVariables;
460/**
461 * Resolve placeholders against the process.env.
462 * Placeholders should be of form ${ENV_VAR}. Placeholders support default values
463 * in case they aren't defined: ${ENV_VAR:default value}
464 * @param {Configuration} config
465 */
466function resolvePlaceholders(cfg) {
467 resolvePlaceholdersRecursively(cfg);
468}
469exports.resolvePlaceholders = resolvePlaceholders;
470function resolvePlaceholdersRecursively(obj) {
471 for (const property in obj) {
472 if (obj.hasOwnProperty(property)) {
473 if (typeof obj[property] === "object") {
474 resolvePlaceholdersRecursively(obj[property]);
475 }
476 else if (typeof obj[property] === "string") {
477 obj[property] = resolvePlaceholder(obj[property]);
478 }
479 }
480 }
481}
482const PlaceholderExpression = /\$\{([.a-zA-Z_-]+)([.:0-9a-zA-Z-_ \" ]+)*\}/g;
483function resolvePlaceholder(value) {
484 if (PlaceholderExpression.test(value)) {
485 PlaceholderExpression.lastIndex = 0;
486 let result;
487 // tslint:disable-next-line:no-conditional-assignment
488 while (result = PlaceholderExpression.exec(value)) {
489 const fm = result[0];
490 const envValue = process.env[result[1]];
491 const defaultValue = result[2] ? result[2].trim().slice(1) : undefined;
492 if (envValue) {
493 value = value.split(fm).join(envValue);
494 }
495 else if (defaultValue) {
496 value = value.split(fm).join(defaultValue);
497 }
498 else {
499 throw new Error(`Environment variable '${result[1]}' is not defined`);
500 }
501 }
502 }
503 return value;
504}
505/**
506 * Invoke postProcessors on the provided configuration.
507 */
508function invokePostProcessors(cfg) {
509 return cfg.postProcessors.reduce((pp, fp) => pp.then(fp), Promise.resolve(cfg));
510}
511exports.invokePostProcessors = invokePostProcessors;
512/**
513 * Make sure final configuration has the minimum configuration it
514 * needs. It will throw an error if required properties are missing.
515 *
516 * @param cfg final configuration
517 */
518function validateConfiguration(cfg) {
519 if (!cfg) {
520 throw new Error(`no configuration defined`);
521 }
522 const errors = [];
523 if (!cfg.name) {
524 errors.push("you must set a 'name' property in your configuration");
525 }
526 if (!cfg.version) {
527 errors.push("you must set a 'version' property in your configuration");
528 }
529 if (!cfg.token && !cfg.apiKey) {
530 errors.push("you must set an 'apiKey' property in your configuration");
531 }
532 if (cfg.token && !cfg.apiKey) {
533 console.warn("WARNING: Usage of 'token' is deprecated and support for it will be removed in a " +
534 "future release. Please use 'apiKey' instead.");
535 }
536 if ((cfg.teamIds && cfg.teamIds.length > 0) && (!cfg.workspaceIds || cfg.workspaceIds.length === 0)) {
537 console.warn("WARNING: Usage of 'teamIds' is deprecated and support for it will be removed in a " +
538 "future release. Please use 'workspaceIds' instead.");
539 }
540 cfg.teamIds = cfg.teamIds || [];
541 cfg.workspaceIds = cfg.workspaceIds || [];
542 if (cfg.workspaceIds.length === 0) {
543 cfg.workspaceIds = cfg.teamIds;
544 }
545 cfg.groups = cfg.groups || [];
546 if (cfg.workspaceIds.length < 1 && cfg.groups.length < 1) {
547 errors.push("you must either provide an array of 'groups' in your configuration or, more likely, provide " +
548 "an array of 'workspaceIds' in your configuration or set the ATOMIST_WORKSPACES environment variable " +
549 "to a comma-separated list of workspace IDs");
550 }
551 if (cfg.workspaceIds.length > 0 && cfg.groups.length > 0) {
552 errors.push("you cannot specify both 'workspaceIds' and 'groups' in your configuration, you must set one " +
553 "to an empty array");
554 }
555 if (errors.length > 0) {
556 const msg = `Configuration (${stringify(cfg, string_1.obfuscateJson)}) is not correct: ${errors.join("; ")}`;
557 throw new Error(msg);
558 }
559}
560exports.validateConfiguration = validateConfiguration;
561/**
562 * Load and populate the automation configuration. The configuration
563 * is loaded from several locations with the following precedence from
564 * highest to lowest.
565 *
566 * 0. Recognized environment variables (see below)
567 * 1. The value of the ATOMIST_CONFIG environment variable, parsed as
568 * JSON and cast to AutomationServerOptions
569 * 2. The contents of the ATOMIST_CONFIG_PATH file as AutomationServerOptions
570 * 3. The automation's atomist.config.js exported configuration as
571 * Configuration
572 * 4. The contents of the user's client.config.json as UserConfig
573 * resolving user and per-module configuration into Configuration
574 * 5. ProductionDefaultConfiguration if ATOMIST_ENV or NODE_ENV is set
575 * to "production" or TestingDefaultConfiguration if ATOMIST_ENV or
576 * NODE_ENV is set to "staging" or "testing", with ATOMIST_ENV
577 * taking precedence over NODE_ENV.
578 * 6. LocalDefaultConfiguration
579 *
580 * If any of the sources are missing, they are ignored. Any truthy
581 * configuration values specified by sources of higher precedence
582 * cause any values provided by sources of lower precedence to be
583 * ignored. Arrays are replaced, not merged. Typically the only
584 * required values in the configuration for a successful registration
585 * are the apiKey or token and non-empty workspaceIds.
586 *
587 * Placeholder of the form `${ENV_VARIABLE}` in string configuration
588 * values will get resolved against the environment. The resolution
589 * happens at the very end when all configs have been merged.
590 *
591 * The configuration exported from the atomist.config.js is modified
592 * to contain the final configuration values and returned from this
593 * function.
594 *
595 * @param cfgPath path to file exporting the configuration object, if
596 * not provided the package is searched for one
597 * @return merged configuration object
598 */
599function loadConfiguration(cfgPath) {
600 // Register the logger globally so that downstream modules can see it
601 global.__logger = logger_1.logger;
602 let cfg;
603 try {
604 const defCfg = defaultConfiguration();
605 const userCfg = loadUserConfiguration(defCfg.name, defCfg.version);
606 const autoCfg = loadAutomationConfig(cfgPath);
607 const atmPathCfg = loadAtomistConfigPath();
608 const atmCfg = loadAtomistConfig();
609 cfg = mergeConfigs({}, defCfg, userCfg, autoCfg, atmPathCfg, atmCfg);
610 resolveWorkspaceIds(cfg);
611 resolveToken(cfg);
612 resolvePort(cfg);
613 resolveEnvironmentVariables(cfg);
614 resolvePlaceholders(cfg);
615 }
616 catch (e) {
617 logger_1.logger.error(`Failed to load configuration: ${e.message}`);
618 if (e.stack) {
619 logger_1.logger.error(`Stack trace:\n${e.stack}`);
620 }
621 return Promise.reject(e);
622 }
623 return invokePostProcessors(cfg)
624 .then(completeCfg => {
625 completeCfg.postProcessors = [];
626 try {
627 validateConfiguration(completeCfg);
628 }
629 catch (e) {
630 return Promise.reject(e);
631 }
632 return Promise.resolve(completeCfg);
633 });
634}
635exports.loadConfiguration = loadConfiguration;
636/**
637 * Default configuration when running in neither testing or
638 * production.
639 */
640exports.LocalDefaultConfiguration = {
641 teamIds: [],
642 workspaceIds: [],
643 groups: [],
644 environment: "local",
645 policy: "ephemeral",
646 endpoints: {
647 api: "https://automation.atomist.com/registration",
648 graphql: "https://automation.atomist.com/graphql/team",
649 },
650 http: {
651 enabled: true,
652 host: "localhost",
653 port: 2866,
654 auth: {
655 basic: {
656 enabled: false,
657 },
658 bearer: {
659 enabled: false,
660 },
661 },
662 customizers: [],
663 client: {
664 factory: axiosHttpClient_1.DefaultHttpClientFactory,
665 },
666 },
667 ws: {
668 enabled: true,
669 termination: {
670 graceful: false,
671 gracePeriod: 10000,
672 },
673 compress: false,
674 timeout: 10000,
675 },
676 applicationEvents: {
677 enabled: false,
678 },
679 cluster: {
680 enabled: false,
681 },
682 logging: {
683 level: "debug",
684 file: {
685 enabled: true,
686 level: "debug",
687 },
688 banner: {
689 enabled: true,
690 contributors: [],
691 },
692 },
693 statsd: {
694 enabled: false,
695 },
696 commands: null,
697 events: null,
698 ingesters: [],
699 listeners: [],
700 postProcessors: [],
701};
702/**
703 * Configuration defaults for production environments.
704 */
705exports.ProductionDefaultConfiguration = {
706 environment: "production",
707 policy: "durable",
708 http: {
709 auth: {
710 basic: {
711 enabled: true,
712 },
713 bearer: {
714 enabled: true,
715 },
716 },
717 },
718 ws: {
719 termination: {
720 graceful: true,
721 },
722 compress: true,
723 },
724 applicationEvents: {
725 enabled: true,
726 },
727 cluster: {
728 enabled: true,
729 },
730 logging: {
731 level: "info",
732 file: {
733 enabled: false,
734 },
735 },
736 statsd: {
737 enabled: true,
738 },
739};
740/**
741 * Configuration defaults for pre-production environments.
742 */
743exports.TestingDefaultConfiguration = {
744 environment: "testing",
745 policy: "durable",
746 http: {
747 auth: {
748 basic: {
749 enabled: true,
750 },
751 bearer: {
752 enabled: true,
753 },
754 },
755 },
756 ws: {
757 termination: {
758 graceful: true,
759 },
760 compress: true,
761 },
762 applicationEvents: {
763 enabled: true,
764 },
765 cluster: {
766 enabled: true,
767 },
768 logging: {
769 level: "info",
770 file: {
771 enabled: false,
772 },
773 },
774 statsd: {
775 enabled: true,
776 },
777};
778//# sourceMappingURL=configuration.js.map
\No newline at end of file