mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +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
|
- Added ability to configure electronOptions
|
||||||
- Calendar module: option to hide private events
|
- Calendar module: option to hide private events
|
||||||
- Add root_path for global vars
|
- Add root_path for global vars
|
||||||
|
- Added console warning on startup when deprecated config options are used
|
||||||
|
|
||||||
### Updated
|
### Updated
|
||||||
- Modified translations for Frysk.
|
- Modified translations for Frysk.
|
||||||
|
1
config/.gitignore
vendored
1
config/.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
*
|
*
|
||||||
!config.js.sample
|
!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 {
|
try {
|
||||||
fs.accessSync(configFilename, fs.F_OK);
|
fs.accessSync(configFilename, fs.F_OK);
|
||||||
var c = require(configFilename);
|
var c = require(configFilename);
|
||||||
|
checkDeprecatedOptions(c);
|
||||||
var config = Object.assign(defaults, c);
|
var config = Object.assign(defaults, c);
|
||||||
callback(config);
|
callback(config);
|
||||||
} catch (e) {
|
} 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)
|
/* loadModule(module)
|
||||||
* Loads a specific module.
|
* Loads a specific module.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user