UNPKG

947 BJavaScriptView Raw
1'use strict'
2
3/**
4 * Convert value to boolean but false if undefined
5 * @param {String} value
6 * @param {String} fallback default value
7 * @return {Boolean}
8 */
9const useIfDefined = (value, fallback) => {
10 if (typeof value === 'undefined') {
11 return fallback
12 } else {
13 return value === 'true'
14 }
15}
16
17/**
18 * Configuration for transporters
19 * Configuration by transporter :
20 * @param {Integer} enabled
21 * @param {Object|String} endpoints sended as first arg with connect() method
22 */
23module.exports = {
24 transporters: {
25 axon: {
26 enabled: false, // useIfDefined(process.env.AGENT_TRANSPORT_AXON, false),
27 endpoints: {
28 push: process.env.AGENT_PUSH_ENDPOINT || 'push',
29 pull: process.env.AGENT_REVERSE_ENDPOINT || 'reverse'
30 }
31 },
32 websocket: {
33 enabled: true, // useIfDefined(process.env.AGENT_TRANSPORT_WEBSOCKET, true),
34 endpoints: process.env.AGENT_WEBSOCKET_ENDPOINT || 'ws'
35 }
36 }
37}