<commit_before># Redis Commander

Redis web management tool written in node.js

![GUI image](./docs/GUI_EXAMPLE.png)

# Install and Run

```bash
$ npm install -g redis-commander
$ redis-commander
```

Installation via `yarn` is currently not supported. Please use `npm` as package manager.

Or run Redis Commander as Docker image `rediscommander/redis-commander` (instructions see below).

# Features

Web-UI to display and edit data within multiple different Redis servers.

It has support for the following data types to view, add, update and delete data:
* Strings
* Lists
* Sets
* Sorted Set
* Streams (Basic support based on HFXBus project from https://github.com/exocet-engineering/hfx-bus, only view/add/delete data)
* ReJSON documents (Basic support, only for viewing values of ReJSON type keys)

# Usage

```
$ redis-commander --help
Options:
  --redis-port                         The port to find redis on.                  [string]
  --redis-host                         The host to find redis on.                  [string]
  --redis-socket                       The unix-socket to find redis on.           [string]
  --redis-password                     The redis password.                         [string]
  --redis-db                           The redis database.                         [string]
  --redis-label                        The label to display for the connection.    [string]
  --redis-tls                          Use TLS for connection to redis server or sentinel. [boolean] [default: false]
  --redis-optional                     Set to true if no permanent auto-reconnect shall be done if server is down [boolean] [default: false]
  --sentinel-port                      The port to find redis sentinel on.         [string]
  --sentinel-host                      The host to find redis sentinel on.         [string]
  --sentinels                          Comma separated list of sentinels with host:port. [string]
  --sentinel-name                      The redis sentinel group name to use.       [string]  [default: mymaster]
  --sentinel-password                  The password for sentinel instance.         [string]
  --http-auth-username, --http-u       The http authorisation username.            [string]
  --http-auth-password, --http-p       The http authorisation password.            [string]
  --http-auth-password-hash, --http-h  The http authorisation password hash.       [string]
  --address, -a                        The address to run the server on.           [string]  [default: 0.0.0.0]
  --port, -p                           The port to run the server on.              [string]  [default: 8081]
  --url-prefix, -u                     The url prefix to respond on.               [string]  [default: ""]
  --root-pattern, --rp                 The root pattern of the redis keys.         [string]  [default: "*"]
  --read-only                          Start app in read-only mode.                [boolean] [default: false]
  --trust-proxy                        App is run behind proxy (enable Express "trust proxy") [boolean|string] [default: false]
  --nosave, --ns                       Do not save new connections to config file. [boolean] [default: true]
  --noload, --nl                       Do not load connections from config.        [boolean] [default: false]
  --use-scan, --sc                     Use scan instead of keys.                   [boolean] [default: false]
  --clear-config, --cc                 clear configuration file.
  --migrate-config                     migrate old configuration file in $HOME to new style.
  --scan-count, --sc                   The size of each seperate scan.             [integer] [default: 100]
  --no-log-data                        Do not log data values from redis store.    [boolean] [default: false]
  --open                               Open web-browser with Redis-Commander.      [boolean] [default: false]
  --folding-char, --fc                 Character to fold keys at in tree view.     [character] [default: ":"]
  --test, -t                           test final configuration (file, env-vars, command line)
```

The connection can be established either via direct connection to redis server or indirect
via a sentinel instance.

## Configuration

Redis Commander can be configured by configuration files, environment variables or using command line
parameters. The different types of config values overwrite each other, only the last (most important)
value is used.

For configuration files the `node-config` module (https://github.com/lorenwest/node-config) is used, with default to json syntax.

The order of precedence for all configuration values (from least to most important) is:

- Configuration files

  `default.json` - this file contains all default values and SHOULD NOT be changed

  `local.json` - optional file, all local overwrites for values inside default.json should be placed here as well
  as a list of redis connections to use at startup

  `local-<NODE_ENV>.json` - Do not add anything else than connections to this file! Redis Commander will overwrite this whenever a
  connection is added or removed via user interface. Inside docker container this file is used to store
  all connections parsed from REDIS_HOSTS env var.
  This file overwrites all connections defined inside `local.json`

  There are some more possible files available to use - please check the node-config Wiki
  for an complete list of all possible file names (https://github.com/lorenwest/node-config/wiki/Configuration-Files)

- Environment variables - the full list of env vars possible (except the docker specific ones)
  can be get from the file `config/custom-environment-variables.json` together with their mapping
  to the respective configuration key.

- Command line parameters - Overwrites everything

To check the final configuration created from files, env-vars set and command line param overwrites
start redis commander with additional param "--test". All invalid configuration keys will be listed
in the output. The config test does not check if hostnames or ip addresses can be resolved.

More informations can be found in the documentation at [docs/configuration.md](docs/configuration.md)
and [docs/connections.md](docs/connections.md).

## Environment Variables

These environment variables can be used starting Redis Commander as normal
application or inside docker container (defined inside file `config/custom-environment-variables.json`):

```
HTTP_USER
HTTP_PASSWORD
HTTP_PASSWORD_HASH
ADDRESS
PORT
READ_ONLY
URL_PREFIX
ROOT_PATTERN
NOSAVE
NO_LOG_DATA
FOLDING_CHAR
VIEW_JSON_DEFAULT
USE_SCAN
SCAN_COUNT
FLUSH_ON_IMPORT
REDIS_CONNECTION_NAME
REDIS_LABEL
CLIENT_MAX_BODY_SIZE
BINARY_AS_HEX
```

## Docker

All environment variables listed at "Environment Variables" can be used running image
with Docker. The following additional environment variables are available too (defined inside
docker startup script):

```
REDIS_PORT
REDIS_HOST
REDIS_SOCKET
REDIS_TLS
REDIS_PASSWORD
REDIS_DB
REDIS_HOSTS
REDIS_OPTIONAL
SENTINEL_PORT
SENTINEL_HOST
SENTINELS
SENTINEL_NAME
SENTINEL_PASSWORD
REDIS_PASSWORD_FILE
SENTINEL_PASSWORD_FILE<commit_msg>read Docker Env vars delete by commit <PASSWORD> and sort env var names<commit_after># Redis Commander

Redis web management tool written in node.js

![GUI image](./docs/GUI_EXAMPLE.png)

# Install and Run

```bash
$ npm install -g redis-commander
$ redis-commander
```

Installation via `yarn` is currently not supported. Please use `npm` as package manager.

Or run Redis Commander as Docker image `rediscommander/redis-commander` (instructions see below).

# Features

Web-UI to display and edit data within multiple different Redis servers.

It has support for the following data types to view, add, update and delete data:
* Strings
* Lists
* Sets
* Sorted Set
* Streams (Basic support based on HFXBus project from https://github.com/exocet-engineering/hfx-bus, only view/add/delete data)
* ReJSON documents (Basic support, only for viewing values of ReJSON type keys)

# Usage

```
$ redis-commander --help
Options:
  --redis-port                         The port to find redis on.                  [string]
  --redis-host                         The host to find redis on.                  [string]
  --redis-socket                       The unix-socket to find redis on.           [string]
  --redis-password                     The redis password.                         [string]
  --redis-db                           The redis database.                         [string]
  --redis-label                        The label to display for the connection.    [string]
  --redis-tls                          Use TLS for connection to redis server or sentinel. [boolean] [default: false]
  --redis-optional                     Set to true if no permanent auto-reconnect shall be done if server is down [boolean] [default: false]
  --sentinel-port                      The port to find redis sentinel on.         [string]
  --sentinel-host                      The host to find redis sentinel on.         [string]
  --sentinels                          Comma separated list of sentinels with host:port. [string]
  --sentinel-name                      The redis sentinel group name to use.       [string]  [default: mymaster]
  --sentinel-password                  The password for sentinel instance.         [string]
  --http-auth-username, --http-u       The http authorisation username.            [string]
  --http-auth-password, --http-p       The http authorisation password.            [string]
  --http-auth-password-hash, --http-h  The http authorisation password hash.       [string]
  --address, -a                        The address to run the server on.           [string]  [default: 0.0.0.0]
  --port, -p                           The port to run the server on.              [string]  [default: 8081]
  --url-prefix, -u                     The url prefix to respond on.               [string]  [default: ""]
  --root-pattern, --rp                 The root pattern of the redis keys.         [string]  [default: "*"]
  --read-only                          Start app in read-only mode.                [boolean] [default: false]
  --trust-proxy                        App is run behind proxy (enable Express "trust proxy") [boolean|string] [default: false]
  --nosave, --ns                       Do not save new connections to config file. [boolean] [default: true]
  --noload, --nl                       Do not load connections from config.        [boolean] [default: false]
  --use-scan, --sc                     Use scan instead of keys.                   [boolean] [default: false]
  --clear-config, --cc                 clear configuration file.
  --migrate-config                     migrate old configuration file in $HOME to new style.
  --scan-count, --sc                   The size of each seperate scan.             [integer] [default: 100]
  --no-log-data                        Do not log data values from redis store.    [boolean] [default: false]
  --open                               Open web-browser with Redis-Commander.      [boolean] [default: false]
  --folding-char, --fc                 Character to fold keys at in tree view.     [character] [default: ":"]
  --test, -t                           test final configuration (file, env-vars, command line)
```

The connection can be established either via direct connection to redis server or indirect
via a sentinel instance.

## Configuration

Redis Commander can be configured by configuration files, environment variables or using command line
parameters. The different types of config values overwrite each other, only the last (most important)
value is used.

For configuration files the `node-config` module (https://github.com/lorenwest/node-config) is used, with default to json syntax.

The order of precedence for all configuration values (from least to most important) is:

- Configuration files

  `default.json` - this file contains all default values and SHOULD NOT be changed

  `local.json` - optional file, all local overwrites for values inside default.json should be placed here as well
  as a list of redis connections to use at startup

  `local-<NODE_ENV>.json` - Do not add anything else than connections to this file! Redis Commander will overwrite this whenever a
  connection is added or removed via user interface. Inside docker container this file is used to store
  all connections parsed from REDIS_HOSTS env var.
  This file overwrites all connections defined inside `local.json`

  There are some more possible files available to use - please check the node-config Wiki
  for an complete list of all possible file names (https://github.com/lorenwest/node-config/wiki/Configuration-Files)

- Environment variables - the full list of env vars possible (except the docker specific ones)
  can be get from the file `config/custom-environment-variables.json` together with their mapping
  to the respective configuration key.

- Command line parameters - Overwrites everything

To check the final configuration created from files, env-vars set and command line param overwrites
start redis commander with additional param "--test". All invalid configuration keys will be listed
in the output. The config test does not check if hostnames or ip addresses can be resolved.

More informations can be found in the documentation at [docs/configuration.md](docs/configuration.md)
and [docs/connections.md](docs/connections.md).

## Environment Variables

These environment variables can be used starting Redis Commander as normal
application or inside docker container (defined inside file `config/custom-environment-variables.json`):

```
HTTP_USER
HTTP_PASSWORD
HTTP_PASSWORD_HASH
ADDRESS
PORT
READ_ONLY
URL_PREFIX
ROOT_PATTERN
NOSAVE
NO_LOG_DATA
FOLDING_CHAR
VIEW_JSON_DEFAULT
USE_SCAN
SCAN_COUNT
FLUSH_ON_IMPORT
REDIS_CONNECTION_NAME
REDIS_LABEL
CLIENT_MAX_BODY_SIZE
BINARY_AS_HEX
```

## Docker

All environment variables listed at "Environment Variables" can be used running image
with Docker. The following additional environment variables are available too (defined inside
docker startup script):

```
HTTP_PASSWORD_FILE
HTTP_PASSWORD_HASH_FILE
REDIS_PORT
REDIS_HOST
REDIS_SOCKET
REDIS_TLS
REDIS_PASSWORD
REDIS_PASSWORD_FILE
REDIS_DB
REDIS_HOSTS
REDIS_OPTIONAL
SENTINEL_PORT
SENTINEL_HOST
SENTINEL_NAME
SENTINEL_PASSWORD
SENTINEL_PASSWORD_FILE
SENTINELS
{'fraction_non_alphanumeric': 0.07054258194165339, 'fraction_numerical': 0.0015244958769316055, 'mean_word_length': 2.428842955571395, 'pattern_counts': {'":': 2, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2416943', 'n_tokens_mistral': 3834, 'n_tokens_neox': 3678, 'n_words': 1581}