How to use the config.get function in config

To help you get started, we’ve selected a few config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github joeferner / redis-commander / bin / redis-commander.js View on Github external
appInstance.listen(config.get('server.port'), config.get('server.address'), function() {
    console.log(`listening on ${config.get('server.address')}:${config.get('server.port')}`);

    // default ip 0.0.0.0 and ipv6 equivalent cannot be opened with browser, need different one
    // may search for first non-localhost address of server instead of 127.0.0.1...
    let address = '127.0.0.1';
    if (config.get('server.address') !== '0.0.0.0' && config.get('server.address') !== '::') {
      address = config.get('server.address');
    }
    let msg = `access with browser at http://${address}:${config.get('server.port')}`;
    if (urlPrefix) {
      console.log(`using url prefix ${urlPrefix}`);
      msg += urlPrefix;
    }
    console.log(msg);
  });
}
github VertigoRay / GDAXBot / strategies / stddev.js View on Github external
addTrades(trades) {
		for (let trade in trades) {
			// console.log('add trade price:', parseFloat(trades[trade].price.toString()))
			this.trade_prices.push(parseFloat(trades[trade].toString()));

			while (this.trade_prices.length > settings.get(`${this.product_id}.strategies.StdDev.trades_n`)) {
				this.trade_prices.shift();
			}
		}
	}
github atomicobject / ts-react-graphql-starter-kit / webpack / webpack-dev-server.js View on Github external
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const webpackConfig = require('./client.config');
const config = require('config');

const { defaults } = require('lodash');

let devServer;
const DEV_PORT = config.get('devServer.port');

const PROXY_HOST = config.get("server.apiHost");


const startDevServer = () => {
  if (devServer) {
    return Promise.resolve(devServer);
  }

  const { hot, inline, noInfo } = defaults(config.get('devServer'), {
    hot: true,
    inline: true,
    noInfo: true,
  });

  // Set up hot reloading entry points.
github wbruno / dragons-api / db / mongoose.js View on Github external
function _connection(vars) {
  var username  = vars.MONGO_USERNAME || config.get('mongo.username'),
      password  = vars.MONGO_PASSWORD || config.get('mongo.password'),
      host      = vars.MONGO_HOST     || config.get('mongo.host'),
      port      = vars.MONGO_PORT     || config.get('mongo.port'),
      database  = vars.MONGO_DATABASE || config.get('mongo.database'),

      auth = username ? /* istanbul ignore next */ username + ':' + password + '@' : '';

  return 'mongodb://' + auth + host + ':' + port + '/' + database;
}
github bigbluebutton / bbb-webrtc-sfu / lib / mcs-core / lib / media / media-controller.js View on Github external
'use strict'

const config = require('config');
const C = require('../constants/constants');
const Logger = require('../utils/logger');
const User = require('../model/user');
const Room = require('../model/room');
const GLOBAL_EVENT_EMITTER = require('../utils/emitter');
const { handleError } = require('../utils/util');
const Balancer = require('./balancer');
const AdapterFactory = require('../adapters/adapter-factory');
const StrategyManager = require('./strategy-manager.js');
const MediaFactory = require('./media-factory.js');
const { global: GLOBAL_MEDIA_THRESHOLD } = config.get('mediaThresholds');
const ALLOW_DUPLICATE_EXT_USER_ID = config.has('allowDuplicateExtUserId')
  ? config.get('allowDuplicateExtUserId')
  : true;

const LOG_PREFIX = "[mcs-controller]";

// Fire that balancer
Balancer.upstartHosts();

let instance = null;

module.exports = class MediaController {
  constructor() {
    if (!instance) {
      this.emitter = GLOBAL_EVENT_EMITTER;
      this.rooms = [];
github hadouken / hadouken / js / core.js View on Github external
// Enable NatPmp
    if(config.get("bittorrent.natpmp.enabled")) {
        logger.info("Enabling NATPMP.");
        session.startNatPmp();
    }

    // Enable UPnP
    if(config.get("bittorrent.upnp.enabled")) {
        logger.info("Enabling UPnP.");
        session.startUpnp();
    }

    // Load session settings
    var settings = session.getSettings();
    settings.connectionsLimit = (config.get("bittorrent.connectionsLimit") || settings.connectionsLimit);
    settings.downloadRateLimit = (config.get("bittorrent.downloadRateLimit") || settings.downloadRateLimit);
    settings.mixedModeAlgorithm = (config.get("bittorrent.mixedModeAlgorithm") || settings.mixedModeAlgorithm);
    settings.rateLimitIpOverhead = (config.get("bittorrent.rateLimitIpOverhead") || settings.rateLimitIpOverhead);
    settings.rateLimitUtp = (config.get("bittorrent.rateLimitUtp") || settings.rateLimitUtp);
    settings.uploadRateLimit = (config.get("bittorrent.uploadRateLimit") || settings.uploadRateLimit);

    // Advanced settings
    var allowMultipleConnectionsPerIp = config.get("bittorrent.allowMultipleConnectionsPerIp");
    if(typeof allowMultipleConnectionsPerIp !== "undefined") { settings.allowMultipleConnectionsPerIp = allowMultipleConnectionsPerIp; }

    var anonymousMode = config.get("bittorrent.anonymousMode");
    if(typeof anonymousMode !== "undefined") { settings.anonymousMode = anonymousMode; }

    var enableUtp = config.get("bittorrent.utp.enabled");
    if(typeof enableUtp !== "undefined") { enableUtp = true; }
    settings.enableOutgoingUtp = enableUtp;
github MarvenGong / fastmock / db / sequelizeInstance.js View on Github external
const Sequelize = require('sequelize');
const config = require('config');
const dbConfig = config.get('db');
const sequelizeOptions = config.get('sequeliszeOptions');
let sequelizeInstance = new Sequelize(dbConfig.database, dbConfig.user, dbConfig.password, sequelizeOptions);
sequelizeInstance
  .authenticate()
  .then(() => {
    console.log('Connection has been established successfully.');
  })
  .catch(err => {
    console.error('Unable to connect to the database:', err);
  });
module.exports = sequelizeInstance;
github elifesciences / elife-xpub / packages / component-meca / server / meca / routes.js View on Github external
const sendEmail = () =>
      mailer
        .send({
          to: config.get('meca.email.recipient'),
          from: config.get('meca.email.sender'),
          subject: `${config.get(
            'meca.email.subjectPrefix',
          )}MECA import failed`,
          text: `
EJP failed to import MECA package.
Manuscript ID: ${manuscriptId}
EJP Body: ${body}
      `,
        })
        .catch(err => {
          throw new Error(`MECA import failure email failed to send. ${err}`)
        })
github bkimminich / juice-shop / lib / startup / customizeApplication.js View on Github external
if (config.get('application.name')) {
    customizeTitle()
  }
  if (config.get('application.logo')) {
    customizeLogo()
  }
  if (config.get('application.favicon')) {
    customizeFavicon()
  }
  if (config.get('application.theme')) {
    customizeTheme()
  }
  if (config.get('application.cookieConsent')) {
    customizeCookieConsentBanner()
  }
  if (config.get('application.promotion')) {
    customizePromotionVideo()
    customizePromotionSubtitles()
  }
  if (config.get('application.deluxePage')) {
    customizeDeluxeDeliveryImage()
  }
}
github VilledeMontreal / workit / packages / workit-cli / src / command / init / templates / node / default / src / src / config / index.ts View on Github external
private constructor() {
    this._environment = config.util.getEnv('NODE_ENV');
    this._camunda = {
      workerId: config.get('camunda.workerId'),
      baseUrl: config.get('camunda.baseUrl'),
      maxTasks: config.get('camunda.maxTasks'),
      topicName: config.get('camunda.topicName')
    };
  }