Skip to content

Commit d13c871

Browse files
committed
no need for localhost and default port in default client options
1 parent 744e744 commit d13c871

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/redis-adapter.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@ const _getRedisOptionsTuple = () => {
9393
if (!__activeOptionsTuple) {
9494
const defaultClientOptions = {
9595
pingInterval: REDIS_CLIENT_DEFAULT_PING_INTERVAL,
96-
socket: {
97-
host: "localhost",
98-
port: 6379,
99-
},
10096
};
10197

10298
const credentials = __customCredentials || cfEnv.cfServiceCredentialsForLabel(CF_REDIS_SERVICE_LABEL);
@@ -105,11 +101,11 @@ const _getRedisOptionsTuple = () => {
105101
const isCluster = !!credentials.cluster_mode;
106102
const credentialClientOptions = hasCredentials
107103
? {
108-
password: credentials.password,
104+
...(Object.prototype.hasOwnProperty.call(credentials, "password") && { password: credentials.password }),
109105
socket: {
110-
host: credentials.hostname,
111-
port: credentials.port,
112-
tls: credentials.tls,
106+
...(Object.prototype.hasOwnProperty.call(credentials, "hostname") && { host: credentials.hostname }),
107+
...(Object.prototype.hasOwnProperty.call(credentials, "port") && { port: credentials.port }),
108+
...(Object.prototype.hasOwnProperty.call(credentials, "tls") && { tls: credentials.tls }),
113109
},
114110
}
115111
: undefined;

0 commit comments

Comments
 (0)