MCPcopy Create free account
hub / github.com/cameri/nostream / redactRedisUrlCredentials

Function redactRedisUrlCredentials

src/cache/client.ts:7–22  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

5const logger = createLogger('cache-client')
6
7const redactRedisUrlCredentials = (url: string): string => {
8 try {
9 const parsedUrl = new URL(url)
10
11 if (!parsedUrl.username && !parsedUrl.password) {
12 return url
13 }
14
15 parsedUrl.username = parsedUrl.username ? '***' : ''
16 parsedUrl.password = parsedUrl.password ? '***' : ''
17
18 return parsedUrl.toString()
19 } catch {
20 return url
21 }
22}
23
24export const getCacheConfig = (): RedisClientOptions => {
25 const password = process.env.REDIS_PASSWORD

Callers 1

getCacheClientFunction · 0.85

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected