discourse/config/initializers/001-redis.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
409 B
Ruby
Raw Normal View History

# frozen_string_literal: true
if Rails.env.development? && ENV['DISCOURSE_FLUSH_REDIS']
puts "Flushing redis (development mode)"
Discourse.redis.flushdb
end
2020-06-16 00:53:04 -04:00
begin
if Gem::Version.new(Discourse.redis.info['redis_version']) < Gem::Version.new("6.2.0")
STDERR.puts "Discourse requires Redis 6.2.0 or up"
exit 1
end
rescue Redis::CannotConnectError
STDERR.puts "Couldn't connect to Redis"
end