@rpcbase/server 0.384.0 → 0.386.0
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/getDerivedKey.ts +1 -1
- package/src/initServer.ts +5 -7
package/package.json
CHANGED
package/src/getDerivedKey.ts
CHANGED
|
@@ -8,7 +8,7 @@ export const getDerivedKey = (
|
|
|
8
8
|
length: number = 32, // Default to 256-bit keys
|
|
9
9
|
salt: string = "",
|
|
10
10
|
): string => {
|
|
11
|
-
assert(masterKey?.length
|
|
11
|
+
assert(masterKey?.length >= 32, "MASTER_KEY must be 32 chars or longer.")
|
|
12
12
|
|
|
13
13
|
return Buffer.from(hkdfSync(
|
|
14
14
|
"sha256",
|
package/src/initServer.ts
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { Application } from "express"
|
|
2
2
|
import session, { SessionOptions } from "express-session"
|
|
3
3
|
import {RedisStore} from "connect-redis"
|
|
4
|
-
import {createClient} from
|
|
4
|
+
import {createClient} from "redis"
|
|
5
5
|
|
|
6
6
|
import { getDerivedKey } from "./getDerivedKey"
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
const SESSION_STORE_HOST = "localhost"
|
|
10
|
-
const SESSION_STORE_PORT = "6379"
|
|
11
|
-
|
|
12
8
|
const isProduction = process.env.NODE_ENV === "production"
|
|
13
9
|
|
|
14
10
|
|
|
15
11
|
export const initServer = async (app: Application, serverEnv: { [key: string]: string | undefined }) => {
|
|
12
|
+
app.disable("x-powered-by")
|
|
16
13
|
|
|
17
14
|
const sessionSecret = getDerivedKey(serverEnv.MASTER_KEY!, "express_session_key")
|
|
18
15
|
|
|
@@ -25,11 +22,11 @@ export const initServer = async (app: Application, serverEnv: { [key: string]:
|
|
|
25
22
|
return new Error("max retries expiered")
|
|
26
23
|
}
|
|
27
24
|
}
|
|
25
|
+
console.log("RECO REDISSSSS", process.env.REDIS_URL)
|
|
28
26
|
|
|
29
27
|
const redisClient = createClient({
|
|
28
|
+
url: process.env.REDIS_URL,
|
|
30
29
|
socket: {
|
|
31
|
-
host: SESSION_STORE_HOST,
|
|
32
|
-
port: Number(SESSION_STORE_PORT),
|
|
33
30
|
reconnectStrategy,
|
|
34
31
|
connectTimeout: 10000,
|
|
35
32
|
keepAlive: 0,
|
|
@@ -41,6 +38,7 @@ export const initServer = async (app: Application, serverEnv: { [key: string]:
|
|
|
41
38
|
})
|
|
42
39
|
|
|
43
40
|
redisClient.on("error", (error) => {
|
|
41
|
+
console.log("2222REDISSSSS", process.env.REDIS_URL)
|
|
44
42
|
console.log("session-storage::redis_client ERROR", error)
|
|
45
43
|
})
|
|
46
44
|
|