mirror of
https://github.com/Redume/Kekkai.git
synced 2025-03-13 03:54:37 +03:00
chore(config): Adapted the code to output a new config. Added an error if there is no config file
This commit is contained in:
parent
dd24356e81
commit
1964fd333a
3 changed files with 11 additions and 14 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue