lib/command/server/config.js
function validate(cmd, args, info) {
  AbstractCommand.prototype.validate.apply(this, arguments);
  var sub = info.command.sub
    , cmd = '' + sub.cmd
    , args = sub.args
    , key
    , val
    , verified;

  if(cmd === Constants.SUBCOMMAND.config.set.name) {
    key = '' + args[0];
    val = '' + args[1];

    // test config key is allowed to be set at runtime
    if(!~Runtime.indexOf(key)) {
      throw new ConfigParameter(key);
    }

    // validate input value and coerce to native type
    try {
      val = this.conf.validate(key, [val]);

      // additional validation after type coercion and
      // basic checks, some methods modify the value (hz)
      // although most just throw an error
      verified = this.conf.verify(key, val);
      if(verified !== undefined) {
        val = verified;
      }
      args[1] = val;
    }catch(e) {
      throw new ConfigValue(key, val);
    }
  }else if(cmd === Constants.SUBCOMMAND.config.rewrite.name) {
    if(this.conf.isDefault()) {
      throw ConfigRewrite;
    }
  }
}
function validate(cmd, args, info) {
  AbstractCommand.prototype.validate.apply(this, arguments);
  var sub = info.command.sub
    , cmd = '' + sub.cmd
    , args = sub.args
    , key
    , val
    , verified;

  if(cmd === Constants.SUBCOMMAND.config.set.name) {
    key = '' + args[0];
    val = '' + args[1];

    // test config key is allowed to be set at runtime
    if(!~Runtime.indexOf(key)) {
      throw new ConfigParameter(key);
    }

    // validate input value and coerce to native type
    try {
      val = this.conf.validate(key, [val]);

      // additional validation after type coercion and
      // basic checks, some methods modify the value (hz)
      // although most just throw an error
      verified = this.conf.verify(key, val);
      if(verified !== undefined) {
        val = verified;
      }
      args[1] = val;
    }catch(e) {
      throw new ConfigValue(key, val);
    }
  }else if(cmd === Constants.SUBCOMMAND.config.rewrite.name) {
    if(this.conf.isDefault()) {
      throw ConfigRewrite;
    }
  }
}
function validate ( cmd , args , info ) { AbstractCommand . prototype . validate . apply ( this , arguments ) ; var sub = info . command . sub , cmd = '' + sub . cmd , args = sub . args , key , val , verified ; if ( cmd === Constants . SUBCOMMAND . config . set . name ) { key = '' + args [ 0 ] ; val = '' + args [ 1 ] ; // test config key is allowed to be set at runtime if ( ! ~ Runtime . indexOf ( key ) ) { throw new ConfigParameter ( key ) ; } // validate input value and coerce to native type try { val = this . conf . validate ( key , [ val ] ) ; // additional validation after type coercion and // basic checks, some methods modify the value (hz) // although most just throw an error verified = this . conf . verify ( key , val ) ; if ( verified !== undefined ) { val = verified ; } args [ 1 ] = val ; } catch ( e ) { throw new ConfigValue ( key , val ) ; } } else if ( cmd === Constants . SUBCOMMAND . config . rewrite . name ) { if ( this . conf . isDefault ( ) ) { throw ConfigRewrite ; } } }
Validate the CONFIG subcommands.
Validate the CONFIG subcommands .