2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-01-07 05:59:28 -06:00
|
|
|
if Rails.env.development? && ENV["DISCOURSE_FLUSH_REDIS"]
|
2013-03-11 07:33:20 -05:00
|
|
|
puts "Flushing redis (development mode)"
|
2020-05-22 23:56:13 -05:00
|
|
|
Discourse.redis.flushdb
|
|
|
|
end
|
2020-06-15 23:53:04 -05:00
|
|
|
|
2022-02-15 09:25:22 -06:00
|
|
|
begin
|
2023-01-07 05:59:28 -06:00
|
|
|
if Gem::Version.new(Discourse.redis.info["redis_version"]) < Gem::Version.new("6.2.0")
|
2022-02-15 09:25:22 -06:00
|
|
|
STDERR.puts "Discourse requires Redis 6.2.0 or up"
|
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
rescue Redis::CannotConnectError
|
|
|
|
STDERR.puts "Couldn't connect to Redis"
|
2022-02-15 07:36:07 -06:00
|
|
|
end
|