@ahhaohho/auth-middleware 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/config/redis.js +10 -2
package/package.json
CHANGED
package/src/config/redis.js
CHANGED
|
@@ -36,8 +36,16 @@ class RedisManager {
|
|
|
36
36
|
maxRetriesPerRequest: null
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
//
|
|
40
|
-
|
|
39
|
+
// TLS 활성화 조건:
|
|
40
|
+
// 1. REDIS_TLS가 명시적으로 'true'로 설정된 경우
|
|
41
|
+
// 2. REDIS_HOST가 설정되지 않고 ELASTICACHE_ENDPOINT를 사용하는 경우
|
|
42
|
+
// 3. localhost/127.0.0.1이 아닌 경우
|
|
43
|
+
const isLocalhost = ['localhost', '127.0.0.1'].includes(config.host);
|
|
44
|
+
const shouldUseTLS =
|
|
45
|
+
process.env.REDIS_TLS === 'true' ||
|
|
46
|
+
(!process.env.REDIS_HOST && process.env.ELASTICACHE_ENDPOINT);
|
|
47
|
+
|
|
48
|
+
if (shouldUseTLS && !isLocalhost) {
|
|
41
49
|
config.tls = {};
|
|
42
50
|
}
|
|
43
51
|
|