diff --git a/CHANGELOG.md b/CHANGELOG.md index 706299cd..237315d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Added ability to configure electronOptions - Calendar module: option to hide private events - Add root_path for global vars +- Added console warning on startup when deprecated config options are used ### Updated - Modified translations for Frysk. diff --git a/config/.gitignore b/config/.gitignore index d85e3bd4..daeb6336 100644 --- a/config/.gitignore +++ b/config/.gitignore @@ -1,2 +1,3 @@ * !config.js.sample +!deprecated.js diff --git a/config/deprecated.js b/config/deprecated.js new file mode 100644 index 00000000..cf305582 --- /dev/null +++ b/config/deprecated.js @@ -0,0 +1,12 @@ +/* Magic Mirror Deprecated Config Options List + * + * By Michael Teeuw http://michaelteeuw.nl + * MIT Licensed. + */ + +var deprecated = [ + 'kioskmode' +]; + +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== 'undefined') {module.exports = deprecated;} diff --git a/js/app.js b/js/app.js index 9f992b29..56216238 100644 --- a/js/app.js +++ b/js/app.js @@ -56,6 +56,7 @@ var App = function() { try { fs.accessSync(configFilename, fs.F_OK); var c = require(configFilename); + checkDeprecatedOptions(c); var config = Object.assign(defaults, c); callback(config); } catch (e) { @@ -72,6 +73,21 @@ var App = function() { } }; + var checkDeprecatedOptions = function(userConfig) { + var deprecatedOptions = require(__dirname + "/../config/deprecated.js"); + var usedDeprecated = []; + + deprecatedOptions.forEach(function(option) { + if (userConfig.hasOwnProperty(option)) { + usedDeprecated.push(option); + } + }); + + if (usedDeprecated.length > 0) { + console.error("WARNING! Your config is using deprecated options: " + usedDeprecated.join(", ") + ". Check README and CHANGELOG for more up-to-date ways of getting the same functionality."); + } + } + /* loadModule(module) * Loads a specific module. *