feat(config): add Cookies.cookiePath option to config

defaults to "/" as previously set by default options
This commit is contained in:
Panagiotis Papadopoulos 2025-02-10 08:33:31 +01:00
parent 48d4093274
commit 3c8723a404
2 changed files with 17 additions and 0 deletions

View File

@ -28,6 +28,15 @@ keyPath=
# expressjs shortcuts are supported: loopback(127.0.0.1/8, ::1/128), linklocal(169.254.0.0/16, fe80::/10), uniquelocal(10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, fc00::/7)
trustedReverseProxy=false
[Cookies]
# Use this setting to constrain the current instance's "Path" value for the set cookies
# This can be useful, when you have several instances running on the same domain, under different paths (e.g. by using a reverse proxy).
# It prevents your instances from overwriting each others' cookies.
# 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
cookiePath=/
[Sync]
#syncServerHost=
#syncServerTimeout=

View File

@ -32,6 +32,9 @@ export interface TriliumConfig {
keyPath: string;
trustedReverseProxy: boolean | string;
};
Cookies: {
cookiePath: string;
}
Sync: {
syncServerHost: string;
syncServerTimeout: string;
@ -76,6 +79,11 @@ const config: TriliumConfig = {
process.env.TRILIUM_NETWORK_TRUSTEDREVERSEPROXY || iniConfig.Network.trustedReverseProxy || false
},
Cookies: {
cookiePath:
process.env.TRILIUM_COOKIES_COOKIEPATH || iniConfig?.Cookies?.cookiePath || "/"
},
Sync: {
syncServerHost:
process.env.TRILIUM_SYNC_SERVER_HOST || iniConfig?.Sync?.syncServerHost || "",