Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "node-yaml-config in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'node-yaml-config' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

// 把所有包的 owners 和 publisher 字段
// 替换为 { name: 'xx', id: 12 } 这样的对象
// 修复 https://github.com/spmjs/spmjs.io/issues/101
// ---
var async = require('async');

// load global config
var yaml = require('node-yaml-config');
var CONFIG = yaml.load('./config/base.yaml');
global.CONFIG = CONFIG;

var models = require('../models');
var Project = require('../models/project');
var Package = require('../models/package');

Project.getAll().forEach(function(projectName) {
  console.log('Start fixing ' + projectName);
  var project = new Project({
    name: projectName
  });

  var tasks = [];
  project.owners.forEach(function(ownerName, i) {
    if (ownerName && typeof ownerName === 'string') {
      tasks.push(function(callback) {
'use strict';

// load global config
var yaml = require('node-yaml-config');
var CONFIG = yaml.load('./config/base.yaml');
global.CONFIG = CONFIG;

var async = require('async');
var models = require('../models');
var dependent = require('../lib/dependent');
var anonymous = CONFIG.authorize.type === 'anonymous';

process.on('message', function(m) {

  function doCache(done) {
    console.log('cacheIndexWorker: do cache for index');
    async.parallel([
      function(callback) {
        models.Download.stat(function(downloadResult) {
          callback(null, downloadResult);
        });
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var compression = require('compression')
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
globalConfig = require('node-yaml-config').load(__dirname + '/config/custom.yml');

var mongoose = require('mongoose');
mongoose.connect(globalConfig.mongodb_url);

var api = require('./routes/api');
var admin = require('./routes/admin');

var app = express();

if (process.env.NODE_ENV == 'dev') {
  console.log('DEV MODE ENABLED');
} else {
  require('./connectors').enableBackgroundCrawl();
}

// view engine setup
var path = require('path');
var multipart = require('connect-multiparty');
var multipartMiddleware = multipart();
var favicon = require('serve-favicon');
var morgan = require('morgan');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var serveStatic = require('serve-static');
var fs = require('fs-extra');
var spmjsioVersion = require('./package').version;
var gitRev = require('git-rev-sync').short();

// load global config
var yaml = require('node-yaml-config');
var CONFIG = yaml.load('./config/base.yaml');
global.CONFIG = CONFIG;

// start sync
require('./sync');

// mkdir data directory
if (!fs.existsSync(CONFIG.wwwroot)) {
  fs.mkdirSync(CONFIG.wwwroot);
}
if (!fs.existsSync(path.join(CONFIG.wwwroot, 'db'))) {
  fs.mkdirSync(path.join(CONFIG.wwwroot, 'db'));
}
if (!fs.existsSync(path.join(CONFIG.wwwroot, 'docs'))) {
  fs.mkdirSync(path.join(CONFIG.wwwroot, 'docs'));
}
if (!fs.existsSync(path.join(CONFIG.wwwroot, 'repository'))) {
'use strict';

var path = require('path');
var join = path.join;

// load global config
var yaml = require('node-yaml-config');
var CONFIG = yaml.load(join(__dirname, '../config/base.yaml'));
global.CONFIG = CONFIG;

var registry = CONFIG.npmSyncRegistry || 'registry.npmjs.org';

var hook = require('../lib/hook');

var request = require('co-request');
var semver = require('semver');
var co = require('co');
var log = require('spm-log');
var format = require('util').format;
var extend = require('extend');
var thunkify = require('thunkify');
var crypto = require('crypto');
var clientTar = require('spm-client').tar;
var moment = require('moment');
'use strict';

var yaml = require('node-yaml-config');
var CONFIG = yaml.load('./config/base.yaml');
global.CONFIG = CONFIG;

var models = require('../models/index');

models.sequelize.sync().then(function() {
  require('async').series([
    function(next) { return transform('Account', next) },
    function(next) { return transform('Download', next) },
    function(next) { return transform('History', next) }
  ], function() {
    console.log('done');
  });
});

function transform(type, done) {
  console.log('transform', type.toLowerCase());
var config   = require('node-yaml-config').load('./config/game.yml');
var fs       = require('fs');

var Cluster  = require('../models/cluster');
var Helper   = require('../core/helpers');
var Sector   = require('../models/sector');
var Shop     = require('../models/shop');
var Trader   = require('../models/trader');
var Universe = require('../models/universe');

var BigBang = function() {
    this.universe = new Universe;
};

BigBang.prototype.start = function() {
    this.initializeSectors();
    this.initializeClusters();
var config   = require('node-yaml-config').load('./config/game.yml');

var Trader = function() {
    this.name    = null;
    this.sector  = 1;
    this.level   = 1;
    this.credits = 0;
    this.ship    = null;
    this.holds   = 100;
    this.cargo   = { 
        fuel      : 0,
        organics  : 0,
        equipment : 0
    };

};
var config       = require('node-yaml-config').load('./config/game.yml');
var util         = require('util');
var EventEmitter = require('events').EventEmitter;

var Shop = function(id, emitter) {
    this.id     = id;
    this.sector = null;
    this.bank   = 0;
    this.type   = 1;
    this.prices = {
        fuel     : 10,
        organics : 10,
        equipment: 10,
    };

    this.inventory = {
        fuel     : 100,
const path = require('path');
const YAMLConfig = require('node-yaml-config');
const dotenv = require('dotenv');
const config = YAMLConfig.load(path.join(__dirname, '../../config/common.yml'));
const env = process.env;
dotenv.config();
overrideWithEnvVars(config);

/**
 * Overrides a config object with the values from environment variables, if found.
 *
 * @param {Object} cfg Config object
 * @param {String} prefix Key prefix
 */
function overrideWithEnvVars(cfg, prefix) {
  prefix = prefix || '';
  for (const key in cfg) {
    const fullKey = prefix + key.toUpperCase();

    if (typeof cfg[key] === 'object' && !Array.isArray(cfg[key]) && cfg[key] !== null) {

Is your System Free of Underlying Vulnerabilities?
Find Out Now