Skip to content

Commit

Permalink
v. 0.8 Added ability to configure Redis password by REDIS_PASSWORD en…
Browse files Browse the repository at this point in the history
…v variable
  • Loading branch information
Ruslan Gainutdinov committed Aug 30, 2017
1 parent 4a61e96 commit 02b83ab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,19 @@ Maven repository is created using [jitpack.io](https://jitpack.io/) [![](https:/
<dependency>
<groupId>com.wizecore</groupId>
<artifactId>persistent-metrics</artifactId>
<version>0.7</version>
<version>0.8</version>
</dependency>
```

## Configuring Redis
## Configuring

By default it uses locally installed Redis (default port, i.e. 6379)
To configure redis use following environment variables:
To configure use following environment variables:

* REDIS_CONF - Redisson JSON [config](https://github.com/redisson/redisson/wiki/2.-Configuration#221-jsonyaml-file-based-configuration) file. Takes precedence.
* REDIS_ADDR - host:port for single server.

## Configuring prefix

By default all metrics is put in redis using prefix "metrics.".
To configure different prefix use METRIC_PREFIX environment variable (dot at the end is added automatically).
* REDIS_ADDR - host:port for single server. Have no effect if REDIS_CONF is defined.
* METRIC_PREFIX - Prefix for all values stored. Default is "metrics.". Dot at the end is added automatically.
* REDIS_PASSWORD - Password for single server. Have no effect if REDIS_CONF is defined.

## License

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.wizecore</groupId>
<artifactId>persistent-metrics</artifactId>
<packaging>jar</packaging>
<version>0.7</version>
<version>0.8</version>
<name>persistent-metrics</name>
<url>http://github.com/wizecore/persistent-metrics</url>

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/wizecore/metrics/PersistenceUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ protected static void init() {
redisAddr = System.getenv("REDIS_ADDR");
}

if (redisPassword == null) {
redisPassword = System.getenv("REDIS_PASSWORD");
}

if (metricPrefix == null) {
metricPrefix = System.getenv("METRIC_PREFIX");
}
Expand Down

0 comments on commit 02b83ab

Please sign in to comment.