Skip to content

Commit

Permalink
fix #1741 - change default to localhost and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
leibale committed Nov 28, 2021
1 parent e81bf64 commit 2d2d58d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions docs/client-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
| Property | Default | Description |
|--------------------------|------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| url | | `redis[s]://[[username][:password]@][host][:port][/db-number]` (see [`redis`](https://www.iana.org/assignments/uri-schemes/prov/redis) and [`rediss`](https://www.iana.org/assignments/uri-schemes/prov/rediss) IANA registration for more details) |
| socket | | Object defining socket connection properties |
| socket.host | `'localhost'` | Hostname to connect to |
| socket | | Object defining socket connection properties. Any [`net.createConnection`](https://nodejs.org/api/net.html#netcreateconnectionoptions-connectlistener) option that is not listed here is supported as well |
| socket.port | `6379` | Port to connect to |
| socket.host | `'localhost'` | Hostname to connect to |
| socket.family | `0` | Version of IP stack. Must be `4 \| 6 \| 0`. The value `0` indicates that both IPv4 and IPv6 addresses are allowed. |
| socket.path | | UNIX Socket to connect to |
| socket.connectTimeout | `5000` | The timeout for connecting to the Redis Server (in milliseconds) |
| socket.noDelay | `true` | Enable/disable the use of [`Nagle's algorithm`](https://nodejs.org/api/net.html#net_socket_setnodelay_nodelay) |
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/client/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class RedisSocket extends EventEmitter {
options ??= {};
if (!(options as net.IpcSocketConnectOpts).path) {
(options as net.TcpSocketConnectOpts).port ??= 6379;
(options as net.TcpSocketConnectOpts).host ??= '127.0.0.1';
(options as net.TcpSocketConnectOpts).host ??= 'localhost';
}

options.connectTimeout ??= 5000;
Expand Down

0 comments on commit 2d2d58d

Please sign in to comment.