feat: Additional httpOnly token for enhanced security in browsers

This commit is contained in:
Maksim Eltyshev
2024-09-01 09:31:04 +02:00
parent d4043c9726
commit 50519f1bcd
18 changed files with 171 additions and 48 deletions

View File

@@ -8,9 +8,12 @@
* https://sailsjs.com/config/custom
*/
const url = require('url');
const path = require('path');
const sails = require('sails');
const parsedBasedUrl = new url.URL(process.env.BASE_URL);
module.exports.custom = {
/**
*
@@ -19,6 +22,8 @@ module.exports.custom = {
*/
baseUrl: process.env.BASE_URL,
baseUrlPath: parsedBasedUrl.pathname,
baseUrlSecure: parsedBasedUrl.protocol === 'https:',
tokenExpiresIn: parseInt(process.env.TOKEN_EXPIRES_IN, 10) || 365,