How to use rc - 10 common examples

To help you get started, we’ve selected a few rc 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 strongloop / loopback-connector-oracle / test / init / init.js View on Github external
// Copyright IBM Corp. 2013,2018. All Rights Reserved.
// Node module: loopback-connector-oracle
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

'use strict';

const juggler = require('loopback-datasource-juggler');
let DataSource = juggler.DataSource;

const config = require('rc')('loopback', {test: {oracle: {}}}).test.oracle;
config.maxConn = 64;

let db;

global.getDataSource = global.getSchema = function() {
  if (db) {
    return db;
  }
  db = new DataSource(require('../../'), config);
  db.log = function(a) {
    // console.log(a);
  };
  return db;
};

global.resetDataSourceClass = function(ctor) {
github strongloop / loopback-connector-mysql / test / init.js View on Github external
// Copyright IBM Corp. 2013,2018. All Rights Reserved.
// Node module: loopback-connector-mysql
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

'use strict';

module.exports = require('should');
const juggler = require('loopback-datasource-juggler');
let DataSource = juggler.DataSource;

var config = require('rc')('loopback', {test: {mysql: {}}}).test.mysql;
global.getConfig = function(options) {
  var dbConf = {
    host: process.env.MYSQL_HOST || config.host || 'localhost',
    port: process.env.MYSQL_PORT || config.port || 3306,
    database: process.env.MYSQL_DATABASE || 'myapp_test',
    username: process.env.MYSQL_USER || config.username,
    password: process.env.MYSQL_PASSWORD || config.password,
    createDatabase: true,
  };

  if (options) {
    for (var el in options) {
      dbConf[el] = options[el];
    }
  }
  return dbConf;
github strongloop / loopback-connector-cassandra / test / init.js View on Github external
// Copyright IBM Corp. 2015,2019. All Rights Reserved.
// Node module: loopback-connector-cassandra
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

var DataSource = require('loopback-datasource-juggler').DataSource;

var config = require('rc')('loopback', {test: {cassandra: {
  host: process.env.CASSANDRA_HOST || 'localhost',
  port: process.env.CASSANDRA_PORT || 9042,
  keyspace: process.env.CASSANDRA_KEYSPACE || 'test',
  replication: process.env.CASSANDRA_REPLICATION || {
    class: 'SimpleStrategy', 
    replication_factor: 3,
  }
}}}).test.cassandra;

global.getDataSource = global.getSchema = function() {
  var db = new DataSource(require('../'), config);
  return db;
};

global.connectorCapabilities = {
  ilike: false,
github strongloop / loopback-connector-mssql / test / init.js View on Github external
// Copyright IBM Corp. 2014,2018. All Rights Reserved.
// Node module: loopback-connector-mssql
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

'use strict';
module.exports = require('should');

const juggler = require('loopback-datasource-juggler');
let DataSource = juggler.DataSource;

let config = {};
try {
  config = require('rc')('loopback', {test: {mssql: {}}}).test.mssql;
} catch (err) {
  config = {
    user: 'demo',
    password: 'L00pBack',
    host: 'localhost',
    database: 'demo',
    supportsOffSetFetch: Math.random() > 0.5,
  };
}

global.getConfig = function(options) {
  const dbConf = {
    host: process.env.MSSQL_HOST || config.host || config.hostname || config.server || 'localhost',
    port: process.env.MSSQL_PORT || config.port || 1433,
    database: process.env.MSSQL_DATABASE || config.database || 'test',
    user: process.env.MSSQL_USER || config.user || config.username,
github strongloop / loopback-connector-oracle / example / app.js View on Github external
// Copyright IBM Corp. 2013,2018. All Rights Reserved.
// Node module: loopback-connector-oracle
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

'use strict';

const g = require('strong-globalize')();
const DataSource = require('loopback-datasource-juggler').DataSource;
const config = require('rc')('loopback', {dev: {oracle: {}}}).dev.oracle;

const ds = new DataSource(require('../'), config);

function show(err, models) {
  if (err) {
    console.error(err);
  } else {
    models.forEach(function(m) {
      console.log(m);
    });
  }
}

/*
ds.discoverModelDefinitions({views: true, limit: 20}, show);
github strongloop / loopback-connector-oracle / example / app-sync.js View on Github external
// Copyright IBM Corp. 2013. All Rights Reserved.
// Node module: loopback-connector-oracle
// US Government Users Restricted Rights - Use, duplication or disclosure
// restricted by GSA ADP Schedule Contract with IBM Corp.
'use strict';

var DataSource = require('loopback-datasource-juggler').DataSource;

var config = require('rc')('loopback', {dev: {oracle: {}}}).dev.oracle;

var ds = new DataSource(require('../'), config);

var results = ds.connector.querySync('SELECT * from PRODUCT');
console.log(results);

results = ds.discoverModelDefinitionsSync({views: true, limit: 20});
console.log(results);

results = ds.discoverModelPropertiesSync('PRODUCT');
console.log(results);

results = ds.discoverModelPropertiesSync('INVENTORY_VIEW',
  {owner: 'STRONGLOOP'});
console.log(results);
github strongloop / loopback-connector-mysql / example / app.js View on Github external
// Copyright IBM Corp. 2013,2016. All Rights Reserved.
// Node module: loopback-connector-mysql
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

'use strict';
var DataSource = require('loopback-datasource-juggler').DataSource;

var config = require('rc')('loopback', {dev: {mysql: {}}}).dev.mysql;

var ds = new DataSource(require('../'), config);

function show(err, models) {
  if (err) {
    console.error(err);
  } else {
    console.log(models);
    if (models) {
      models.forEach(function(m) {
        console.dir(m);
      });
    }
  }
}
github adidas / htmplar / packages / htmplar-plugin-react / src / utils.js View on Github external
// utils

import fs from 'fs';
import rc from 'rc';
import defaults from '../.htmplarrc.json';

const { defaultCss } = rc('htmplar', defaults);

const getDefaultStyles = () => fs.readFileSync(`${ __dirname }/base.css`);

const getTemplateDefaultStyles = () => {
  if (defaultCss && defaultCss !== 'false') {
    return fs.readFileSync(defaultCss);
  }

  return '';
};

const getBaseStyles = () => {
  const defaultStyles = getDefaultStyles();
  const templateStyles = getTemplateDefaultStyles();

  return {
github 10up / generator-wp-make / yo-profile / src / yo-profile.js View on Github external
load( defaults, file ) {
		if ( undefined === file ) {
			file = 'yoprofile';
		}

		// Parse the stored config
		let config = rc( file );

		let profile;
		if ( undefined !== config.profile ) {
			// The profile is explicitly set
			profile = config.profile;
		} else if ( undefined !== config.default ) {
			profile = config.default;
		}

		// If we're specifying a profile, fetch that profile
		if ( undefined !== profile && undefined !== config[ profile ] ) {
			_.extend( defaults, config[ profile ] );
		}

		this._props = defaults;
github adidas / htmplar / packages / htmplar-serve / src / utils.js View on Github external
// htmplar-serve utils

import rc from 'rc';
import defaults from '../.htmplarrc.json';

export const cfg = rc('htmplar', defaults);

rc

hardwired configuration loader

(BSD-2-Clause OR MIT OR Apach…
Latest version published 6 years ago

Package Health Score

70 / 100
Full package analysis