Skip to content

Commit

Permalink
[william.dembo] feat(config): add config for redis password
Browse files Browse the repository at this point in the history
  • Loading branch information
walbertus committed Jan 13, 2020
1 parent a3d1c74 commit c06e2bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/app/service/infra/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type ProctorConfig struct {
AppPort string
DefaultNamespace string
RedisAddress string
RedisPassword string
LogsStreamReadBufferSize int
RedisMaxActiveConnections int
LogsStreamWriteBufferSize int
Expand Down Expand Up @@ -120,6 +121,7 @@ func load() ProctorConfig {
AppPort: GetStringDefault(fang, "app.port", "5001"),
DefaultNamespace: fang.GetString("default.namespace"),
RedisAddress: fang.GetString("redis.address"),
RedisPassword: fang.GetString("redis.password"),
RedisMaxActiveConnections: fang.GetInt("redis.max.active.connections"),
LogsStreamReadBufferSize: fang.GetInt("logs.stream.read.buffer.size"),
LogsStreamWriteBufferSize: fang.GetInt("logs.stream.write.buffer.size"),
Expand Down
8 changes: 8 additions & 0 deletions internal/app/service/infra/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ func TestRedisAddress(t *testing.T) {
assert.Equal(t, value, load().RedisAddress)
}

func TestRedisPassword(t *testing.T) {
fake.Seed(0)
value := fake.FirstName()
_ = os.Setenv("PROCTOR_REDIS_PASSWORD", value)

assert.Equal(t, value, load().RedisPassword)
}

func TestRedisMaxActiveConnections(t *testing.T) {
fake.Seed(0)
number := fake.Number(10, 90)
Expand Down

0 comments on commit c06e2bd

Please sign in to comment.