Use express-session-level
This commit is contained in:
parent
17df6e29b1
commit
d6b4a0f32d
6 changed files with 204 additions and 7 deletions
|
@ -4,6 +4,6 @@ module.exports = {
|
|||
defaultFailureRedirect: process.env.DEFAULT_FAILURE_REDIRECT || '/login',
|
||||
port: process.env.PORT || 3000,
|
||||
proxyServer: process.env.PROXY_SERVER || undefined,
|
||||
secret: process.env.SECRET || require('uuid/v4')(),
|
||||
secret: process.env.SECRET || require('./secret'),
|
||||
siteTitle: process.env.SITE_TITLE || 'Christmas Community'
|
||||
};
|
||||
|
|
13
config/secret/index.js
Normal file
13
config/secret/index.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
const uuid = require('uuid/v4');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const secretFilePath = path.join(__dirname, 'secret.txt');
|
||||
|
||||
try {
|
||||
module.exports = fs.readFileSync(secretFilePath).toString();
|
||||
} catch (_) {
|
||||
const secret = uuid();
|
||||
fs.writeFileSync(secretFilePath, secret);
|
||||
module.exports = secret;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue