From 43a14bd1ff6743b12041fcc839c9ee65b2c61eea Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Fri, 16 Dec 2022 15:57:19 +0800 Subject: [PATCH 1/6] allow customizing express session prefix to make it easier to identify keys coming from companion the default value is just "sess:" which is a bit hard to identify --- packages/@uppy/companion/src/standalone/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/@uppy/companion/src/standalone/index.js b/packages/@uppy/companion/src/standalone/index.js index 649826d243..95623372db 100644 --- a/packages/@uppy/companion/src/standalone/index.js +++ b/packages/@uppy/companion/src/standalone/index.js @@ -120,7 +120,8 @@ module.exports = function server (inputCompanionOptions = {}) { if (companionOptions.redisUrl) { const RedisStore = connectRedis(session) const redisClient = redis.client(companionOptions) - sessionOptions.store = new RedisStore({ client: redisClient }) + // todo next major: change default prefix to something like "companion:" + sessionOptions.store = new RedisStore({ client: redisClient, prefix: process.env.REDIS_EXPRESS_SESSION_PREFIX || 'sess:' }) } if (process.env.COMPANION_COOKIE_DOMAIN) { From 77466340ce5450bf82deca3630b6200e0cffb326 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Fri, 16 Dec 2022 16:13:01 +0800 Subject: [PATCH 2/6] rename --- packages/@uppy/companion/src/standalone/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@uppy/companion/src/standalone/index.js b/packages/@uppy/companion/src/standalone/index.js index 95623372db..79ab077fa3 100644 --- a/packages/@uppy/companion/src/standalone/index.js +++ b/packages/@uppy/companion/src/standalone/index.js @@ -121,7 +121,7 @@ module.exports = function server (inputCompanionOptions = {}) { const RedisStore = connectRedis(session) const redisClient = redis.client(companionOptions) // todo next major: change default prefix to something like "companion:" - sessionOptions.store = new RedisStore({ client: redisClient, prefix: process.env.REDIS_EXPRESS_SESSION_PREFIX || 'sess:' }) + sessionOptions.store = new RedisStore({ client: redisClient, prefix: process.env.COMPANION_REDIS_EXPRESS_SESSION_PREFIX || 'sess:' }) } if (process.env.COMPANION_COOKIE_DOMAIN) { From 20ef557ed93d03c2990d3643e47185214854d87c Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Thu, 22 Dec 2022 14:44:40 +0800 Subject: [PATCH 3/6] document COMPANION_REDIS_EXPRESS_SESSION_PREFIX --- website/src/docs/companion.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/website/src/docs/companion.md b/website/src/docs/companion.md index 9d6624b68c..8c1282482f 100644 --- a/website/src/docs/companion.md +++ b/website/src/docs/companion.md @@ -295,8 +295,15 @@ export COMPANION_PERIODIC_PING_URLS="https://example.com/ping1,https://example.c export COMPANION_PERIODIC_PING_INTERVAL=60000 # corresponds to the periodicPingStaticPayload option (JSON string) export COMPANION_PERIODIC_PING_STATIC_JSON_PAYLOAD="{\"static\":\"data\"}" + +# Set a custom prefix for redis keys created by [connect-redis](https://github.com/tj/connect-redis). Defaults to `sess:`. Sessions are used for storing authentication state and for allowing thumbnails to be loaded by the browser via Companion. You might want to change this because if you run a redis with many different apps in the same redis server, it's hard to know where `sess:` comes from and it might collide with other apps. **Note:** in the future ,we plan and changing the default to `companion:` and possibly remove this option. +export COMPANION_REDIS_EXPRESS_SESSION_PREFIX="sess:" ``` +when merged https://github.com/transloadit/uppy/pull/4249 + +```` + See [`.env.example`](https://github.com/transloadit/uppy/blob/main/.env.example) for an example environment configuration file. ### Options @@ -353,7 +360,7 @@ const options = { periodicPingStaticPayload: { static: 'payload' }, corsOrigins: true, } -``` +```` 1. **filePath(required)** - Full path to the directory to which provider files will be downloaded temporarily. From ba968033b0e97cf1f18c38404516992ccc05fed3 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Thu, 22 Dec 2022 14:50:13 +0800 Subject: [PATCH 4/6] change todo --- packages/@uppy/companion/src/standalone/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@uppy/companion/src/standalone/index.js b/packages/@uppy/companion/src/standalone/index.js index 79ab077fa3..5336d759f1 100644 --- a/packages/@uppy/companion/src/standalone/index.js +++ b/packages/@uppy/companion/src/standalone/index.js @@ -120,7 +120,7 @@ module.exports = function server (inputCompanionOptions = {}) { if (companionOptions.redisUrl) { const RedisStore = connectRedis(session) const redisClient = redis.client(companionOptions) - // todo next major: change default prefix to something like "companion:" + // todo next major: change default prefix to something like "companion:" and possibly remove this option sessionOptions.store = new RedisStore({ client: redisClient, prefix: process.env.COMPANION_REDIS_EXPRESS_SESSION_PREFIX || 'sess:' }) } From 995294652abcbb7d4ae597409ead3e0004b92cd8 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Thu, 22 Dec 2022 23:41:53 +0800 Subject: [PATCH 5/6] Update companion.md --- website/src/docs/companion.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/website/src/docs/companion.md b/website/src/docs/companion.md index 8c1282482f..b4e32269c0 100644 --- a/website/src/docs/companion.md +++ b/website/src/docs/companion.md @@ -300,10 +300,6 @@ export COMPANION_PERIODIC_PING_STATIC_JSON_PAYLOAD="{\"static\":\"data\"}" export COMPANION_REDIS_EXPRESS_SESSION_PREFIX="sess:" ``` -when merged https://github.com/transloadit/uppy/pull/4249 - -```` - See [`.env.example`](https://github.com/transloadit/uppy/blob/main/.env.example) for an example environment configuration file. ### Options From fea8cc3a1c73015e7053e13975d05afa4ee2a660 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Thu, 22 Dec 2022 23:42:19 +0800 Subject: [PATCH 6/6] Update companion.md --- website/src/docs/companion.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/docs/companion.md b/website/src/docs/companion.md index b4e32269c0..312e9c0474 100644 --- a/website/src/docs/companion.md +++ b/website/src/docs/companion.md @@ -356,7 +356,7 @@ const options = { periodicPingStaticPayload: { static: 'payload' }, corsOrigins: true, } -```` +``` 1. **filePath(required)** - Full path to the directory to which provider files will be downloaded temporarily.