diff --git a/backend/.env.template b/backend/.env.template index 2d2374698..5858a5d1e 100644 --- a/backend/.env.template +++ b/backend/.env.template @@ -10,6 +10,7 @@ SMTP_USERNAME= SMTP_PASSWORD= JWT_SECRET="b/&&7b78BF&fv/Vd" +JWT_EXPIRES="2y" MAPBOX_TOKEN="pk.eyJ1IjoiYnVzZmFrdG9yIiwiYSI6ImNraDNiM3JxcDBhaWQydG1uczhpZWtpOW4ifQ.7TNRTO-o9aK1Y6MyW_Nd4g" PRIVATE_KEY_PASSPHRASE="a7dsf78sadg87ad87sfagsadg78" diff --git a/backend/src/config/index.js b/backend/src/config/index.js index b7d500b8b..178010508 100644 --- a/backend/src/config/index.js +++ b/backend/src/config/index.js @@ -35,6 +35,7 @@ const required = { const server = { CLIENT_URI: env.CLIENT_URI || 'http://localhost:3000', GRAPHQL_URI: env.GRAPHQL_URI || 'http://localhost:4000', + JWT_EXPIRES: env.JWT_EXPIRES || '2y', } const smtp = { diff --git a/backend/src/jwt/encode.js b/backend/src/jwt/encode.js index 50e439474..baeb62d3d 100644 --- a/backend/src/jwt/encode.js +++ b/backend/src/jwt/encode.js @@ -5,7 +5,7 @@ import CONFIG from './../config' export default function encode(user) { const { id, name, slug } = user const token = jwt.sign({ id, name, slug }, CONFIG.JWT_SECRET, { - expiresIn: '2y', + expiresIn: CONFIG.JWT_EXPIRES, issuer: CONFIG.GRAPHQL_URI, audience: CONFIG.CLIENT_URI, subject: user.id.toString(),