# Redis Configuration Store

The Redis Configuration Store extends the Vert.x Configuration Retriever and provides the way to retrieve configuration from a Redis server.

## Using the Redis Configuration Store

To use the Redis Configuration Store, add the following dependency to the dependencies section of your build descriptor:

- Maven (in your `pom.xml`):

    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-config-redis</artifactId>
      <version>3.4.0.Beta1</version>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-config</artifactId>
      <version>3.4.0.Beta1</version>
    </dependency>

- Gradle (in your `build.gradle` file):

    compile 'io.vertx:vertx-config:3.4.0.Beta1'
    compile 'io.vertx:vertx-config-redis:3.4.0.Beta1'

## Configuring the store

Once added to your classpath or dependencies, you need to configure the `ConfigRetriever` to use this store:

    import io.vertx.config.ConfigRetriever
    import io.vertx.config.ConfigRetrieverOptions
    import io.vertx.config.ConfigStoreOptions
    import io.vertx.kotlin.config.*
    import io.vertx.kotlin.core.json.*

    var store = ConfigStoreOptions(
      type = "redis",
      config = json {
        obj(
          "host" to "localhost",
          "port" to 6379,
          "key" to "my-configuration"
        )
      })

    var retriever = ConfigRetriever.create(vertx, ConfigRetrieverOptions(
      stores = listOf(store)))

The store configuration is used to create an instance of `RedisClient`. check the documentation of the Vert.x Redis Client for further details.

In addition, you can set the `key` instructing the store in which field the configuration is stored. `configuration` is used by default.

The created Redis client retrieves the configuration using the `HGETALL` configuration.