Сервис конфига

This commit is contained in:
Данил 2024-07-30 18:05:02 +03:00
parent 08bbb5dd67
commit a2eccb53e9
4 changed files with 64 additions and 0 deletions

1
config/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
node_modules/

13
config/main.js Normal file
View file

@ -0,0 +1,13 @@
const fs = require('fs');
const yaml = require('yaml');
const config = () => {
try {
fs.readFileSync('../config.yaml', 'utf-8');
} catch { return }
return yaml.parse(fs.readFileSync('../config.yaml', 'utf-8'));
}
module.exports = config;

28
config/package-lock.json generated Normal file
View file

@ -0,0 +1,28 @@
{
"name": "config",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "config",
"version": "1.0.0",
"license": "GPL-3.0-or-later",
"dependencies": {
"yaml": "^2.5.0"
}
},
"node_modules/yaml": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz",
"integrity": "sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==",
"license": "ISC",
"bin": {
"yaml": "bin.mjs"
},
"engines": {
"node": ">= 14"
}
}
}
}

22
config/package.json Normal file
View file

@ -0,0 +1,22 @@
{
"name": "config",
"version": "1.0.0",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Redume/Kekkai.git"
},
"author": "Redume",
"license": "GPL-3.0-or-later",
"bugs": {
"url": "https://github.com/Redume/Kekkai/issues"
},
"homepage": "https://github.com/Redume/Kekkai#readme",
"description": "",
"dependencies": {
"yaml": "^2.5.0"
}
}