feat(config): add Session.cookieMaxAge

allows users to control how long their session will be live, before it expires and they are forced to login again

defaults to 1 day  ("24 * 60 * 60 * 1000") as previously set in sessionParser
This commit is contained in:
Panagiotis Papadopoulos 2025-02-10 19:50:30 +01:00
parent 69a6739d1f
commit 53576f5578
2 changed files with 6 additions and 1 deletions

View File

@ -36,6 +36,7 @@ trustedReverseProxy=false
# e.g. if you have https://your-domain.com/triliumNext/instanceA and https://your-domain.com/triliumNext/instanceB # e.g. if you have https://your-domain.com/triliumNext/instanceA and https://your-domain.com/triliumNext/instanceB
# you would want to set the cookiePath value to "/triliumNext/instanceA" for your first and "/triliumNext/instanceB" for your second instance # you would want to set the cookiePath value to "/triliumNext/instanceA" for your first and "/triliumNext/instanceB" for your second instance
cookiePath=/ cookiePath=/
cookieMaxAge=
[Sync] [Sync]
#syncServerHost= #syncServerHost=

View File

@ -34,6 +34,7 @@ export interface TriliumConfig {
}; };
Session: { Session: {
cookiePath: string; cookiePath: string;
cookieMaxAge: number;
} }
Sync: { Sync: {
syncServerHost: string; syncServerHost: string;
@ -81,7 +82,10 @@ const config: TriliumConfig = {
Session: { Session: {
cookiePath: cookiePath:
process.env.TRILIUM_SESSION_COOKIEPATH || iniConfig?.Session?.cookiePath || "/" process.env.TRILIUM_SESSION_COOKIEPATH || iniConfig?.Session?.cookiePath || "/",
cookieMaxAge:
process.env.TRILIUM_SESSION_COOKIEMAXAGE || iniConfig?.Session?.cookieMaxAge || "24 * 60 * 60 * 1000" // 24 hours in Milliseconds
}, },
Sync: { Sync: {