Check config before starting MM (#3450)

I think it might be a good idea to check the config at every start.
This commit is contained in:
Kristjan ESPERANTO 2024-09-18 19:37:25 +02:00 committed by GitHub
parent 659e0c74cb
commit 866419eb95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 1 deletions

View File

@ -11,6 +11,7 @@ _This release is scheduled to be released on 2024-10-01._
### Added ### Added
- [core] Check config at every start of MagicMirror² (#3450)
- [core] Add spelling check (cspell): `npm run test:spelling` and handle spelling issues - [core] Add spelling check (cspell): `npm run test:spelling` and handle spelling issues
- [core] removed `config.paths.vendor` (could not work because `vendor` is hardcoded in `index.html`), renamed `config.paths.modules` to `config.foreignModulesDir`, added variable `MM_CUSTOMCSS_FILE` which - if set - overrides `config.customCss`, added variable `MM_MODULES_DIR` which - if set - overrides `config.foreignModulesDir` - [core] removed `config.paths.vendor` (could not work because `vendor` is hardcoded in `index.html`), renamed `config.paths.modules` to `config.foreignModulesDir`, added variable `MM_CUSTOMCSS_FILE` which - if set - overrides `config.customCss`, added variable `MM_MODULES_DIR` which - if set - overrides `config.foreignModulesDir`
- [core] elements are now removed from index.html when loading script or stylesheet files fails - [core] elements are now removed from index.html when loading script or stylesheet files fails

View File

@ -117,6 +117,8 @@ function App () {
} }
} }
require(`${global.root_path}/js/check_config.js`);
try { try {
fs.accessSync(configFilename, fs.F_OK); fs.accessSync(configFilename, fs.F_OK);
const c = require(configFilename); const c = require(configFilename);

View File

@ -64,12 +64,13 @@ function checkConfigFile () {
for (const error of errors) { for (const error of errors) {
Log.error(`Line ${error.line} column ${error.column}: ${error.message}`); Log.error(`Line ${error.line} column ${error.column}: ${error.message}`);
} }
return; process.exit(1);
} }
Log.info("Checking modules structure configuration... "); Log.info("Checking modules structure configuration... ");
const position_list = Utils.getModulePositions(); const position_list = Utils.getModulePositions();
// Make Ajv schema configuration of modules config // Make Ajv schema configuration of modules config
// only scan "module" and "position" // only scan "module" and "position"
const schema = { const schema = {