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