From d5638cd450b6fb4822f8dfab93dae9884257be26 Mon Sep 17 00:00:00 2001 From: dekabu Date: Tue, 13 May 2025 08:19:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=84=D0=B0=D0=B9=D0=BB=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .gitmodules | 6 ++++++ db | 1 + run | 1 + src/main.js | 28 ++++++++++++++++++++++++++++ www | 1 + 6 files changed, 38 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 160000 db create mode 120000 run create mode 100755 src/main.js create mode 160000 www diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d344ba6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config.json diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..b04c444 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "db"] + path = db + url = https://dgit.su/komp/db +[submodule "www"] + path = www + url = https://dgit.su/komp/www diff --git a/db b/db new file mode 160000 index 0000000..2b8b6b8 --- /dev/null +++ b/db @@ -0,0 +1 @@ +Subproject commit 2b8b6b8bc005ea2a5cf6bbd8afecc07dc1ad00f7 diff --git a/run b/run new file mode 120000 index 0000000..fbe6a39 --- /dev/null +++ b/run @@ -0,0 +1 @@ +src/main.js \ No newline at end of file diff --git a/src/main.js b/src/main.js new file mode 100755 index 0000000..4a91865 --- /dev/null +++ b/src/main.js @@ -0,0 +1,28 @@ +#!/bin/node + +import fs from 'fs' +import path from 'path' +import process from 'process' + +const Config = { + PORT: 8000, + DB: path.resolve(process.cwd(), 'db'), + WWW: path.resolve(process.cwd(), 'www') +} + +if (fs.existsSync('config.json')) { + console.log('Найден файл config.json') + let json = JSON.parse(fs.readFileSync('config.json')); + + Config.PORT = json.PORT || Config.PORT + Config.DB = json.DB || Config.DB + Config.WWW = json.WWW || Config.WWW +} +else + console.log('Файл config.json не найден. Конфигурация по умолчанию.') + +console.log(`Порт: ${Config.PORT}`) +console.log(`База данных: ${Config.DB}`) +console.log(`Веб-контент: ${Config.WWW}`) + +fs.writeFileSync('config.json', JSON.stringify(Config, null, 2)) diff --git a/www b/www new file mode 160000 index 0000000..7ee23d4 --- /dev/null +++ b/www @@ -0,0 +1 @@ +Subproject commit 7ee23d4cae7f9a2e89b8ce173c0070343f302988