Make default configuration work #14
4 changed files with 14 additions and 11 deletions
|
@ -33,13 +33,9 @@ npm i
|
||||||
```
|
```
|
||||||
This will install all of the node modules.
|
This will install all of the node modules.
|
||||||
|
|
||||||
Then, run:
|
***OPTIONAL***: You may want to edit secret.js and have jwtPrivateKey set to a randomly generated key, such as with /dev/urandom. This will allow session cookies to persist after server reboot.
|
||||||
```
|
|
||||||
cp secret.js.template secret.js
|
|
||||||
```
|
|
||||||
This will create a new secret.js based on that template.
|
|
||||||
|
|
||||||
***IMPORTANT***: Open secret.js with your favourite editor, and set the jwtPrivateKey variable to a random string of characters, preferably generated from /dev/urandom or using node's own generation thing.
|
If you don't set one yourself, a private key will be randomly generated each time the server starts.
|
||||||
|
|
||||||
|
|
||||||
***NOTE***: You can edit config.js to tweak some of the settings. You might wanna do that, especially if you are planning to run it on a domain. (setting the address variable)
|
***NOTE***: You can edit config.js to tweak some of the settings. You might wanna do that, especially if you are planning to run it on a domain. (setting the address variable)
|
||||||
|
|
|
@ -9,7 +9,7 @@ module.exports = {
|
||||||
// }
|
// }
|
||||||
//},
|
//},
|
||||||
corsAllowList: [ 'localhost' ],
|
corsAllowList: [ 'localhost' ],
|
||||||
mongoUrl: 'mongodb://192.168.0.105:27017/app',
|
mongoUrl: 'mongodb://localhost:27017/app',
|
||||||
bcryptRounds: 10,
|
bcryptRounds: 10,
|
||||||
roleMap: {
|
roleMap: {
|
||||||
'BANNED': 0,
|
'BANNED': 0,
|
||||||
|
|
10
secret.js
Executable file
10
secret.js
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
module.exports = {
|
||||||
|
jwtPrivateKey: 'KEY'
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set default values
|
||||||
|
// You shouldn't need to touch this for configuring this
|
||||||
|
if (module.exports.jwtPrivateKey === 'KEY') {
|
||||||
|
console.error('[*] [config] jwtPrivateKey was not specified in secret.js. A randomly generated private key will be used instead');
|
||||||
|
module.exports.jwtPrivateKey = require('crypto').randomBytes(129).toString('base64');
|
||||||
|
}
|
|
@ -1,3 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
jwtPrivateKey: 'KEY'
|
|
||||||
};
|
|
Reference in a new issue