Skip to content

Commit e001ec8

Browse files
committed
Add Env for ExpireAt
1 parent 4ed9dab commit e001ec8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ const PARSE_LDAP_SERVICE_USER_DN = process.env.PARSE_LDAP_SERVICE_USER_DN || "";
3232
const PARSE_LDAP_SERVICE_USER_PW = process.env.PARSE_LDAP_SERVICE_USER_PW || "";
3333
const PARSE_LDAP_SERVICE_GROUP_DN = process.env.PARSE_LDAP_SERVICE_GROUP_DN || "";
3434
const PARSE_LDAP_SERVICE_INTERVAL = parseInt(process.env.PARSE_LDAP_SERVICE_INTERVAL || "");
35+
const PARSE_LDAP_EXPIRE_LENGTH = process.env.PARSE_LDAP_EXPIRE_LENGTH
36+
? new Date(Date.now() + Number(process.env.PARSE_LDAP_EXPIRE_LENGTH) * 1000)
37+
: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365);
3538

3639
const PARSE_LDAP_UNIFY_CREDENTIALS = process.env.PARSE_LDAP_UNIFY_CREDENTIALS === "true";
3740

@@ -143,7 +146,7 @@ async function init() {
143146
sessionToken,
144147
user: user_a,
145148
restricted: false,
146-
expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365),
149+
expiresAt: PARSE_LDAP_EXPIRE_LENGTH,
147150
installationId: request.installationId,
148151
createdWith: {
149152
action: "login",

0 commit comments

Comments
 (0)