I need to loop through a YAML sequence and build an array with the sequence items.
I assume my YAML sequence should look like this in my config/redis:
redis:
host:
port:
sentinels:
- 1.34.79.100
- 1.45.79.101
- 1.46.79.102
In my config/initializers/sidekiq.rb I have a configure_client block that looks like:
Sidekiq.configure_client do |config|
config.redis = {
master_name: 'util-master'
sentinels: [
"sentinel://#{first_redis_sentinel}:23679"
"sentinel://#{second_redis_sentinel}:23679"
"sentinel://#{third_redis_sentinel}:23679"
],
failover_reconnect_timeout: 20,
url: "redis://#{redis_host}:6379/12" }
end
I don't know how to dynamically load the listed Redis sentinels into that array. Do I need to build that array outside of the hash and configure_client block?
load_file.