diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-25 10:12:46 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-25 10:12:46 +0100 |
commit | 82a4f80cd23ecb0a734c21668bc8561734d96e36 (patch) | |
tree | f50f2cbbc79b0b05ed9d58f66f63e26f35a1eaba /lib/config/index.js | |
parent | f47a3968b7a78af8091906fe8936cd00581ae05f (diff) | |
download | gitbook-82a4f80cd23ecb0a734c21668bc8561734d96e36.zip gitbook-82a4f80cd23ecb0a734c21668bc8561734d96e36.tar.gz gitbook-82a4f80cd23ecb0a734c21668bc8561734d96e36.tar.bz2 |
Use jsonschema to validate configuration
Diffstat (limited to 'lib/config/index.js')
-rw-r--r-- | lib/config/index.js | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/config/index.js b/lib/config/index.js index 8bb93ad..272e92a 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -3,7 +3,7 @@ var semver = require('semver'); var gitbook = require('../gitbook'); var Promise = require('../utils/promise'); -var configDefault = require('./default'); +var validator = require('./validator'); var plugins = require('./plugins'); // Config files to tested (sorted) @@ -69,8 +69,7 @@ Config.prototype.load = function() { Config.prototype.replace = function(options) { var that = this; - this.options = _.cloneDeep(configDefault); - this.options = _.merge(this.options, options || {}); + this.options = validator.validate(options); // options.input == book.root Object.defineProperty(this.options, 'input', { @@ -85,13 +84,6 @@ Config.prototype.replace = function(options) { return that.book.parent? that.book.parent.root : undefined; } }); - - // options.originalOutput == book.parent.options.output - Object.defineProperty(this.options, 'originalOutput', { - get: function () { - return that.book.parent? that.book.parent.options.output : undefined; - } - }); }; // Return true if book has a configuration file |