mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Added console warning for deprecated config options
This commit is contained in:
parent
9bd42ac221
commit
90616c82b6
@ -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.
|
||||
|
1
config/.gitignore
vendored
1
config/.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
*
|
||||
!config.js.sample
|
||||
!deprecated.js
|
||||
|
12
config/deprecated.js
Normal file
12
config/deprecated.js
Normal file
@ -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;}
|
16
js/app.js
16
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.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user