Добавил файлы
This commit is contained in:
parent
8749d38a1a
commit
d5638cd450
6 changed files with 38 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
config.json
|
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
[submodule "db"]
|
||||
path = db
|
||||
url = https://dgit.su/komp/db
|
||||
[submodule "www"]
|
||||
path = www
|
||||
url = https://dgit.su/komp/www
|
1
db
Submodule
1
db
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 2b8b6b8bc005ea2a5cf6bbd8afecc07dc1ad00f7
|
1
run
Symbolic link
1
run
Symbolic link
|
@ -0,0 +1 @@
|
|||
src/main.js
|
28
src/main.js
Executable file
28
src/main.js
Executable file
|
@ -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))
|
1
www
Submodule
1
www
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 7ee23d4cae7f9a2e89b8ce173c0070343f302988
|
Loading…
Add table
Add a link
Reference in a new issue