Skip to content

Commit

Permalink
Pass the redis configuration to the initializer as a hash read
Browse files Browse the repository at this point in the history
straight from the yaml file, instead of as a string that must be
split on :. This allows us to specify a database index to use,
instead of simply falling back to the default 0 database.

Update the redis example configuration to match.
  • Loading branch information
Antennapedia committed Nov 23, 2011
1 parent 70f2e9a commit 9eb0c0c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
3 changes: 1 addition & 2 deletions config/initializers/gem-plugin_config/redis.rb
Expand Up @@ -10,8 +10,7 @@
end

redis_config = YAML.load_file(rails_root + '/config/redis.yml')
redis_host, redis_port = redis_config[rails_env].split(":")
$redis = Redis.new(:host => redis_host, :port => redis_port)
$redis = Redis.new(redis_config[rails_env])



15 changes: 12 additions & 3 deletions config/redis.example
@@ -1,3 +1,12 @@
test: dev.ao3.org:6398
development: dev.ao3.org:6379
production: redis.ao3.org:6379
test:
:host: dev.ao3.org
:port: 6398
:db: 0
development:
:host: dev.ao3.org
:port: 6379
:db: 0
production:
:host: redis.ao3.org
:port: 6379
:db: 0

0 comments on commit 9eb0c0c

Please sign in to comment.