changed location of settings to env file

This commit is contained in:
leca 2023-10-27 22:22:25 +03:00
parent 853850f8af
commit bfd647eb41
2 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,4 @@
const express = require('express');
const settings = require('../settings.json');
const { Client } = require('pg');
const session = require('express-session');
const dotenv = require('dotenv');
@ -13,7 +12,7 @@ dotenv.config({ path: './web.env' });
const db = new Client({
user: process.env.DB_USER,
host: "127.0.0.1",
host: "db",
database: process.env.DB_NAME,
password: process.env.DB_PASS,
port: 5432
@ -45,7 +44,7 @@ const init = async () => {
let tokens = {};
app.set('views','/usr/share/dach/public');
app.set('views','./public');
app.use(express.static('public'));
app.set('view engine', 'ejs');
app.use(express.urlencoded({ extended: true }))
@ -120,6 +119,6 @@ app.post('/api/createBoard', async (req, res) => {
return res.status(200).send("Борда успешно создана");
});
app.listen(settings.port, () => {
app.listen(process.env.APP_PORT, () => {
console.log("App started");
});

View File

@ -3,4 +3,6 @@ INSTANCE_NAME=DachChan
DB_USER=dach
DB_PASS=0b45b85307c42f800e5755f3dee5189946a2d8b9
DB_NAME=dach
SESSION_SECRET=7b3f80766f14a2ffa455492cd5ee023a4b8e926a
SESSION_SECRET=7b3f80766f14a2ffa455492cd5ee023a4b8e926a
APP_PORT=1337
BOARD_NAME=Dachan