@codefresh-io/service-base 3.0.8 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/infra/config.js CHANGED
@@ -62,10 +62,18 @@ base.postgres = {
62
62
 
63
63
  base.mongo = {
64
64
  uri: process.env.MONGO_URI || `mongodb://${APPLICATION_DOMAIN}/${name}`,
65
- reconnectTries: process.env.MONGO_RECONNECT_TRIES || Number.MAX_VALUE,
66
- reconnectInterval: process.env.MONGO_RECONNECT_INTERVAL || 30 * 1000,
65
+ options: {
66
+ reconnectTries: process.env.MONGO_RECONNECT_TRIES || Number.MAX_VALUE,
67
+ reconnectInterval: process.env.MONGO_RECONNECT_INTERVAL || 30 * 1000,
68
+ },
67
69
  };
68
70
 
71
+ if (process.env.MTLS_CERT_PATH) {
72
+ const credentials = fs.readFileSync(process.env.MTLS_CERT_PATH);
73
+ base.mongo.options.sslKey = credentials;
74
+ base.mongo.options.sslCert = credentials;
75
+ }
76
+
69
77
  base.logger = {
70
78
  filePath: process.env.LOGS_PATH || path.join(__dirname, '../../logs', 'kubernetes-logs.log'),
71
79
  console: true,
@@ -88,8 +96,8 @@ base.logger = {
88
96
  }
89
97
  // human readable format
90
98
  return `${options.timestamp()} ${options.level.toUpperCase()} >> ` +
91
- `${options.message || ''}` +
92
- `${options.meta && Object.keys(options.meta).length ? ` << ${JSON.stringify(options.meta)}` : ''}`;
99
+ `${options.message || ''}` +
100
+ `${options.meta && Object.keys(options.meta).length ? ` << ${JSON.stringify(options.meta)}` : ''}`;
93
101
  },
94
102
  },
95
103
  basePath: null,
package/infra/mongo.js CHANGED
@@ -17,8 +17,7 @@ class Mongo {
17
17
  init(config) {
18
18
  const clientSettings = {
19
19
  promiseLibrary: Promise,
20
- reconnectTries: config.mongo.reconnectTries,
21
- reconnectInterval: config.mongo.reconnectInterval,
20
+ ...config.mongo.options,
22
21
  };
23
22
 
24
23
  const logger = require('cf-logs').Logger('codefresh:infra:mongo'); // eslint-disable-line
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codefresh-io/service-base",
3
- "version": "3.0.8",
3
+ "version": "3.0.9",
4
4
  "main": "index.js",
5
5
  "description": "",
6
6
  "engines": {