mirror of
https://github.com/Lissy93/dashy.git
synced 2026-07-30 11:06:09 -04:00
🐛 Fixes using absolute path for opening conf.yml in the validator
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
const fs = require('fs'); // For opening + reading files
|
||||
const path = require('path'); // For resolving the config file path
|
||||
const yaml = require('js-yaml'); // For parsing YAML
|
||||
const Ajv = require('ajv'); // For validating with schema
|
||||
|
||||
@@ -101,7 +102,8 @@ const printFileReadError = (e) => {
|
||||
let config = {};
|
||||
|
||||
try { // Try to open and parse the YAML file
|
||||
config = yaml.load(fs.readFileSync(`./${process.env.USER_DATA_DIR || 'user-data'}/conf.yml`, 'utf8'));
|
||||
const confPath = path.resolve(__dirname, '..', process.env.USER_DATA_DIR || 'user-data', 'conf.yml');
|
||||
config = yaml.load(fs.readFileSync(confPath, 'utf8'));
|
||||
validate(config);
|
||||
} catch (e) { // Something went very wrong...
|
||||
setIsValidVariable(false);
|
||||
|
||||
Reference in New Issue
Block a user