Skip to content

Commit

Permalink
APERTA-9087 Convert string to array and leave it as an array
Browse files Browse the repository at this point in the history
  • Loading branch information
tadp committed Mar 27, 2017
1 parent 42b5afd commit 3259e0c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions config/initializers/sidekiq.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
sentinels = ENV['REDIS_SENTINELS']
# YAML is part of the Ruby standard library and it is used here to convert
# "['server1', 'server2', 'server3']" into ['server1', 'server2', 'server3']
require 'yaml'
sentinels = YAML::load(ENV['REDIS_SENTINELS'])
Sidekiq.configure_server do |config|
if sentinels.present?
sentinel_list = sentinels.join(',').map do |sentinel_host|
sentinel_list = sentinels.map do |sentinel_host|
{ host: sentinel_host, port: ENV['REDIS_PORT'] }
end.join(',')
end
config.redis = {
master_name: 'aperta',
sentinels: sentinel_list,
Expand Down Expand Up @@ -31,9 +34,9 @@

Sidekiq.configure_client do |config|
if sentinels.present?
sentinel_list = sentinels.join(',').map do |sentinel_host|
sentinel_list = sentinels.map do |sentinel_host|
{ host: sentinel_host, port: ENV['REDIS_PORT'] }
end.join(',')
end
config.redis = {
master_name: 'aperta',
sentinels: sentinel_list,
Expand Down

0 comments on commit 3259e0c

Please sign in to comment.