mirror of
https://github.com/Redume/Kekkai.git
synced 2025-03-12 19:44:39 +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
17
shared/config/package-lock.json
generated
17
shared/config/package-lock.json
generated
|
@ -9,19 +9,16 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"yaml": "^2.5.0"
|
"hjson": "^3.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/yaml": {
|
"node_modules/hjson": {
|
||||||
"version": "2.5.0",
|
"version": "3.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/hjson/-/hjson-3.2.2.tgz",
|
||||||
"integrity": "sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==",
|
"integrity": "sha512-MkUeB0cTIlppeSsndgESkfFD21T2nXPRaBStLtf3cAYA2bVEFdXlodZB0TukwZiobPD1Ksax5DK4RTZeaXCI3Q==",
|
||||||
"license": "ISC",
|
"license": "MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
"yaml": "bin.mjs"
|
"hjson": "bin/hjson"
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 14"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,6 @@
|
||||||
"homepage": "https://github.com/Redume/Kekkai#readme",
|
"homepage": "https://github.com/Redume/Kekkai#readme",
|
||||||
"description": "Config management service",
|
"description": "Config management service",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"yaml": "^2.5.0"
|
"hjson": "^3.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const yaml = require('yaml');
|
const hjson = require('hjson');
|
||||||
|
|
||||||
const config = () => {
|
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;
|
module.exports = config;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue