Skip to content

Commit 0fd4a4f

Browse files
author
gondzo
committed
login environment configuration
1 parent 0308251 commit 0fd4a4f

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ See https://github.com/lorenwest/node-config/wiki/Configuration-Files
2727
|`JWT_SECRET`| The jwt secret |
2828
|`mail.SMTP_HOST`| The smtp hostname |
2929
|`mail.SMTP_PORT`| The smtp port |
30+
|`mail.EMAIL_FROM`| The from email address |
3031
|`mail.SMTP_USERNAME`| The smtp username |
3132
|`mail.SMTP_PASSWORD`| The smtp password |
3233

@@ -61,8 +62,8 @@ you also can export those values before run(data from forum).
6162
`export AUTH0_CLIENT_ID="3CGKzjS2nVSqHxHHE64RhvvKY6e0TYpK"`
6263
`export JWT_SECRET="fJtXfFYt-F9iees7CSw8rOOr-tYsJocoZTz3pLF5NynamB07JFPeFOEuzfbcT7SD"`
6364
`export MONGOLAB_URI="mongodb://topcoder:[email protected]:47777/dsp1"`
64-
#modify
65-
register and social login add role params
66-
default is `consumer` if role is empty
67-
#video
68-
https://youtu.be/rYBDekZ-hik
65+
`export SMTP_HOST="smtp.gmail.com"`
66+
`export SMTP_PORT="465"`
67+
`export SMTP_USERNAME="youremail"`
68+
`export SMTP_PASSWORD="yourpassword"`
69+
`export EMAIL_FROM="[email protected]"`

common/Auth.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const config = require('config');
1515

1616
const jwtCheck = jwt({
1717
// the auth0 doesn't base 64 encode the jwt secret now
18-
secret: config.JWT_SECRET,
18+
secret: new Buffer(config.JWT_SECRET, 'base64'),
1919
audience: config.AUTH0_CLIENT_ID,
2020
requestProperty: 'auth',
2121
getToken: function fromHeaderOrQuerystring(req) {

config/default.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ module.exports = {
2525
poolSize: 5,
2626
},
2727
mail: {
28-
SMTP_HOST: 'smtp.mailgun.org',
29-
SMTP_PORT: 587,
30-
FROM_EMAIL: '[email protected]',
28+
SMTP_HOST: process.env.SMTP_HOST,
29+
SMTP_PORT: process.env.SMTP_PORT,
30+
FROM_EMAIL: process.env.EMAIL_FROM,
3131
SMTP_USERNAME: process.env.SMTP_USERNAME,
3232
SMTP_PASSWORD: process.env.SMTP_PASSWORD,
3333
},

0 commit comments

Comments
 (0)