Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/valkey-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
#define CLI_RCFILE_DEFAULT ".valkeyclirc"
#define CLI_AUTH_ENV "VALKEYCLI_AUTH"
#define OLD_CLI_AUTH_ENV "REDISCLI_AUTH"
#define CLI_HOST_ENV "VALKEYCLI_HOST"
#define CLI_PORT_ENV "VALKEYCLI_PORT"
#define CLI_CLUSTER_YES_ENV "VALKEYCLI_CLUSTER_YES"
#define OLD_CLI_CLUSTER_YES_ENV "REDISCLI_CLUSTER_YES"

Expand Down Expand Up @@ -2931,6 +2933,14 @@ static void parseEnv(void) {
if (auth != NULL && config.conn_info.auth == NULL) {
config.conn_info.auth = auth;
}
char *host = getenv(CLI_HOST_ENV);
if (host != NULL) {
config.conn_info.hostip = sdsnew(host);
}
char *port = getenv(CLI_PORT_ENV);
if (port != NULL) {
config.conn_info.hostport = atoi(port);
}

/* Check for cluster yes flag with fallback to legacy env variable */
char *cluster_yes = getenv(CLI_CLUSTER_YES_ENV);
Expand Down