lib/config.js
function Config(opts) {
  _.extend(this, {
    appName: 'ndm', // used by rc.
    serviceJsonPath: path.resolve(process.cwd(), 'service.json'),
    tmpServiceJsonPath: null, // used during install phase.
    logsDirectory: this.defaultLogsDirectory(),
    env: process.env,
    uid: null,
    gid: null,
    console: null, // In upstart 1.4, where should logs be sent? <logged|output|owner|none>
    sudo: null,
    headless: false,
    filter: null,
    modulePrefix: '',
    nodeBin: process.execPath,
    baseWorkingDirectory: path.resolve(process.cwd()),
    globalPackage: false,
    platform: null, // override the platform ndm generates services for
    platformApis: {
      ubuntu: require('./platform-apis/ubuntu'),
      centos: require('./platform-apis/centos'),
      darwin: require('./platform-apis/darwin'),
      initd: require('./platform-apis/init-d')
    },
    parsers: {
      sudo: function(v) { return v.toString() === 'true' },
      headless: function(v) { return v.toString() === 'true' },
      globalPackage: function(v) { return v.toString() === 'true' }
    }
  }, opts);

  // allow platform to be overridden.
  this.platform = this.os();

  // allow platform and env to be overridden before applying.
  _.extend(this, this._getEnv(), opts);

  this._rcOverride();
}
function Config(opts) {
  _.extend(this, {
    appName: 'ndm', // used by rc.
    serviceJsonPath: path.resolve(process.cwd(), 'service.json'),
    tmpServiceJsonPath: null, // used during install phase.
    logsDirectory: this.defaultLogsDirectory(),
    env: process.env,
    uid: null,
    gid: null,
    console: null, // In upstart 1.4, where should logs be sent? <logged|output|owner|none>
    sudo: null,
    headless: false,
    filter: null,
    modulePrefix: '',
    nodeBin: process.execPath,
    baseWorkingDirectory: path.resolve(process.cwd()),
    globalPackage: false,
    platform: null, // override the platform ndm generates services for
    platformApis: {
      ubuntu: require('./platform-apis/ubuntu'),
      centos: require('./platform-apis/centos'),
      darwin: require('./platform-apis/darwin'),
      initd: require('./platform-apis/init-d')
    },
    parsers: {
      sudo: function(v) { return v.toString() === 'true' },
      headless: function(v) { return v.toString() === 'true' },
      globalPackage: function(v) { return v.toString() === 'true' }
    }
  }, opts);

  // allow platform to be overridden.
  this.platform = this.os();

  // allow platform and env to be overridden before applying.
  _.extend(this, this._getEnv(), opts);

  this._rcOverride();
}
function Config ( opts ) { _ . extend ( this , { appName : 'ndm' , // used by rc. serviceJsonPath : path . resolve ( process . cwd ( ) , 'service.json' ) , tmpServiceJsonPath : null , // used during install phase. logsDirectory : this . defaultLogsDirectory ( ) , env : process . env , uid : null , gid : null , console : null , // In upstart 1.4, where should logs be sent? <logged|output|owner|none> sudo : null , headless : false , filter : null , modulePrefix : '' , nodeBin : process . execPath , baseWorkingDirectory : path . resolve ( process . cwd ( ) ) , globalPackage : false , platform : null , // override the platform ndm generates services for platformApis : { ubuntu : require ( './platform-apis/ubuntu' ) , centos : require ( './platform-apis/centos' ) , darwin : require ( './platform-apis/darwin' ) , initd : require ( './platform-apis/init-d' ) } , parsers : { sudo : function ( v ) { return v . toString ( ) === 'true' } , headless : function ( v ) { return v . toString ( ) === 'true' } , globalPackage : function ( v ) { return v . toString ( ) === 'true' } } } , opts ) ; // allow platform to be overridden. this . platform = this . os ( ) ; // allow platform and env to be overridden before applying. _ . extend ( this , this . _getEnv ( ) , opts ) ; this . _rcOverride ( ) ; }
handles loading and detecting configuration pulling together OS-specific variables, ENV, and args.
handles loading and detecting configuration pulling together OS - specific variables ENV and args .