diff --git a/config-sample.ini b/config-sample.ini index 90c7fa17e..58d5c87ba 100644 --- a/config-sample.ini +++ b/config-sample.ini @@ -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= diff --git a/src/services/config.ts b/src/services/config.ts index dbbf644b5..7dff7ad0a 100644 --- a/src/services/config.ts +++ b/src/services/config.ts @@ -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 || "",