All files schema.js

72.73% Statements 8/11
60% Branches 6/10
100% Functions 1/1
70% Lines 7/10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 581x 1x 1x   1x                     1x 1x   1x                                                                              
const buffer = require('crypto').randomBytes(60);
const token = buffer.toString('base64').replace(/\//g,'_').replace(/\+/g,'-');
const path = require('path');
 
module.exports = {
  __root: 'port',
  port: {
    default: 3000,
    type: Number
  },
  public: {
    default: 'public',
    type: [String, Boolean],
    file: true,
    clean: (value, option) => {
      Eif (/^win/.test(process.platform) && value === 'C:\\Users\\Public') {
        value = option.arg.public || option.def.default;
 
        Eif (!value) return;
        const fullpath = path.isAbsolute(value) ? value : path.join(process.cwd(), value);
        return path.normalize(fullpath);
      }
      return value;
    }
  },
  env: {
    default: 'development',
    enum: ['production', 'test', 'development'],
    arg: false,
    env: 'NODE_ENV'
  },
  engine: {
    default: 'pug',
    type: [String, Object]
  },
  views: {
    default: 'views',
    type: String,
    folder: true
  },
  secret: {
    default: 'secret-' + token,
    type: String,
    arg: false
    // TODO: integrate this
    // if (options.secret === 'your-random-string-here') {
    //   throw new ServerError('/server/options/secret/example');
    // }
    //
    // if (/^secret-/.test(options.secret) && options.verbose) {
    //   console.log(new ServerError('/server/options/secret/generated'));
    // }
  },
  'x-powered-by': {
    default: false
  }
};