2018-10-07 19:15:10 +03:00
|
|
|
/**
|
|
|
|
* This module reads configuration file depending on NODE_ENV
|
|
|
|
*
|
|
|
|
* @type {module}
|
|
|
|
*/
|
|
|
|
|
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
|
|
|
const NODE_ENV = process.env.NODE_ENV || 'development';
|
|
|
|
const configPath = `./${NODE_ENV}.json`;
|
|
|
|
let config;
|
|
|
|
|
|
|
|
if (fs.existsSync(path.resolve(__dirname, configPath))) {
|
|
|
|
config = require(configPath);
|
|
|
|
} else {
|
|
|
|
config = {
|
|
|
|
database: '.db',
|
Authentication (#22)
* Authorization added
* added secret to password, md5 hashing, removed promise from verifyToken, deleted links when not authorized
* added dbinsert script
* turned verifyToken to middleware, added description for dbinsert, added hidden csrf field in auth form
* added middlewares, user model and controller
* JSDoc fix
* wrong password processing fix
* added comments to dbinsert script, moved salt and passHash to singe db doc
* Moved salt to .env, upgradedscript for generating password was, fixed comments and JSDoc
* Deleted using salt (now user is only one), changed verifying password to bcrypt.compare, added httpyOnly property to jwt cookie
2019-03-06 13:22:57 +03:00
|
|
|
port: 3000,
|
|
|
|
secret: 'secret'
|
2018-10-07 19:15:10 +03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = config;
|