Skip to content

Commit 621bba8

Browse files
committed
Allow to pass redis options via ENV variable
1 parent abe184a commit 621bba8

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

README.md

+30
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,23 @@ OPTIONS:
7979
-v, --version Print the version and exit.
8080
```
8181

82+
#### ENV variables
83+
Options can be set via ENV variables
84+
```
85+
Build ID RSPECQ_BUILD
86+
Worker ID RSPECQ_WORKER
87+
Redis HOST RSPECQ_REDIS
88+
Timings RSPECQ_UPDATE_TIMINGS
89+
File split threshold RSPECQ_FILE_SPLIT_THRESHOLD
90+
Report RSPECQ_REPORT
91+
Report Timeout RSPECQ_REPORT_TIMEOUT
92+
Max requests RSPECQ_MAX_REQUEUES
93+
Queue wait timeout RSPECQ_QUEUE_WAIT_TIMEOUT
94+
Redis URL RSPECQ_REDIS_URL
95+
Redis options (JSON) RSPECQ_REDIS_OPTS
96+
Fail fast RSPECQ_FAIL_FAST
97+
98+
```
8299
### Sentry integration
83100

84101
RSpecQ can optionally emit build events to a
@@ -194,6 +211,19 @@ on every run (if the `--update-timings` option was used). Also, RSpecQ has a
194211
"slow file threshold" which, currently has to be set manually (but this can be
195212
improved in the future).
196213

214+
### CircleCI integration
215+
As CircleCI does not allow to spin up shared Redis instance, Redis server should be configured outside CircleCI environment.
216+
Redis connection credentials could be set as CircleCI project environment variable `RSPECQ_REDIS_URL`
217+
218+
Secure redis connection is supported via `rediss://` schema, additional TLS options can be specified via `RSPECQ_REDIS_OPTS` env variable in JSON format.
219+
For example `{ "ssl_params": { "ca_file": "spec/support/lib/ca_heroku.crt", "verify_hostname": false } }`
220+
221+
`circle.yml` could run rspecq as:
222+
```yml
223+
- type: shell
224+
command: |
225+
bundle exec rspecq --build=${CIRCLE_BUILD_NUM} --worker=${CIRCLE_NODE_INDEX}
226+
```
197227
198228
## Development
199229

bin/rspecq

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ raise OptionParser::MissingArgument.new(:build) if opts[:build].nil?
124124
raise OptionParser::MissingArgument.new(:worker) if !opts[:report] && opts[:worker].nil?
125125
# rubocop:enable Style/RaiseArgs, Layout/EmptyLineAfterGuardClause
126126

127-
redis_opts = {}
127+
redis_opts = JSON.parse(ENV.fetch("RSPECQ_REDIS_OPTS", "{}")).deep_symbolize_keys
128128

129129
if opts[:redis_url]
130130
redis_opts[:url] = opts[:redis_url]

0 commit comments

Comments
 (0)