소스 검색

@uppy/companion: change default value for Redis session prefix (#5198)

`COMPANION_REDIS_EXPRESS_SESSION_PREFIX` to `companion-session:`.
Mikael Finstad 11 달 전
부모
커밋
c9c2641b96
3개의 변경된 파일13개의 추가작업 그리고 10개의 파일을 삭제
  1. 4 8
      docs/companion.md
  2. 8 0
      docs/guides/migration-guides.md
  3. 1 2
      packages/@uppy/companion/src/standalone/index.js

+ 4 - 8
docs/companion.md

@@ -372,14 +372,10 @@ using many instances. See [How to scale Companion](#how-to-scale-companion).
 #### `COMPANION_REDIS_EXPRESS_SESSION_PREFIX`
 
 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. This is a standalone-only option. See also
-`COMPANION_REDIS_PUBSUB_SCOPE`.
+[connect-redis](https://github.com/tj/connect-redis). Defaults to
+`companion-session:`. Sessions are used for storing authentication state and for
+allowing thumbnails to be loaded by the browser via Companion and for OAuth2.
+See also `COMPANION_REDIS_PUBSUB_SCOPE`.
 
 #### `redisOptions` `COMPANION_REDIS_OPTIONS`
 

+ 8 - 0
docs/guides/migration-guides.md

@@ -2,6 +2,14 @@
 
 These cover all the major Uppy versions and how to migrate to them.
 
+## Migrate from Uppy 3.x to 4.x
+
+### Companion
+
+- `COMPANION_REDIS_EXPRESS_SESSION_PREFIX` now defaults to `companion-session:`
+  (before `sess:`). To revert keep backwards compatibility, set the environment
+  variable `COMPANION_REDIS_EXPRESS_SESSION_PREFIX=sess:`.
+
 ## Migrate from Robodog to Uppy plugins
 
 Uppy is flexible and extensible through plugins. But the integration code could

+ 1 - 2
packages/@uppy/companion/src/standalone/index.js

@@ -117,8 +117,7 @@ module.exports = function server(inputCompanionOptions) {
 
   const redisClient = redis.client(companionOptions)
   if (redisClient) {
-    // todo next major: change default prefix to something like "companion-session:" and possibly remove this option
-    sessionOptions.store = new RedisStore({ client: redisClient, prefix: process.env.COMPANION_REDIS_EXPRESS_SESSION_PREFIX || 'sess:' })
+    sessionOptions.store = new RedisStore({ client: redisClient, prefix: process.env.COMPANION_REDIS_EXPRESS_SESSION_PREFIX || 'companion-session:' })
   }
 
   if (process.env.COMPANION_COOKIE_DOMAIN) {