chore(config): Adapted the code to output a new config. Added an error if there is no config file

This commit is contained in:
Данил 2025-03-03 09:44:49 +03:00
parent dd24356e81
commit 1964fd333a
3 changed files with 11 additions and 14 deletions

View file

@ -1,10 +1,10 @@
const fs = require('fs');
const yaml = require('yaml');
const hjson = require('hjson');
const config = () => {
if (!fs.existsSync('../config.yaml')) return;
if (!fs.existsSync('../config.hjson')) throw new Error('Config not found');
return yaml.parse(fs.readFileSync('../config.yaml', 'utf-8'));
return hjson.parse(fs.readFileSync('../config.hjson', 'utf-8'));
};
module.exports = config;