Перенес файлы в общую папку

This commit is contained in:
Данил 2024-08-14 17:14:38 +03:00
parent b9a45b69b4
commit 7c835e145a
14 changed files with 7 additions and 9 deletions

1
shared/config/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
node_modules/

28
shared/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"
}
}
}
}

View file

@ -0,0 +1,22 @@
{
"name": "config",
"version": "1.0.0",
"main": "src/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": "Config management service",
"dependencies": {
"yaml": "^2.5.0"
}
}

11
shared/config/src/main.js Normal file
View file

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