Compare commits

..

No commits in common. "9ed67992a1d45929160f1915eedfd1fd3d36b94d" and "45a4a50812bdac30100ea703cdb3b89b0491ea12" have entirely different histories.

4 changed files with 11 additions and 14 deletions

View file

@ -33,9 +33,13 @@ npm i
``` ```
This will install all of the node modules. This will install all of the node modules.
***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. Then, run:
```
cp secret.js.template secret.js
```
This will create a new secret.js based on that template.
If you don't set one yourself, a private key will be randomly generated each time the server starts. ***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.
***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)
@ -47,4 +51,4 @@ Just run Brainlet with the command below:
node index.js node index.js
``` ```
Good luck! Good luck!

View file

@ -9,7 +9,7 @@ module.exports = {
// } // }
//}, //},
corsAllowList: [ 'localhost' ], corsAllowList: [ 'localhost' ],
mongoUrl: 'mongodb://localhost:27017/app', mongoUrl: 'mongodb://192.168.0.105:27017/app',
bcryptRounds: 10, bcryptRounds: 10,
roleMap: { roleMap: {
'BANNED': 0, 'BANNED': 0,

View file

@ -1,10 +0,0 @@
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');
}

3
secret.js.template Executable file
View file

@ -0,0 +1,3 @@
module.exports = {
jwtPrivateKey: 'KEY'
};