Skip to content

Commit 3dc604f

Browse files
Kagemarudaniel-illi
authored andcommitted
Adhoc fixes to get this branch working
1 parent 989a222 commit 3dc604f

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

Gemfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ source 'https://rubygems.org'
22

33
gem 'rails', '~> 5.2.x'
44

5-
gem 'pg', '~> 0.21.0'
5+
gem 'pg', '= 0.21.0'
66
gem 'activerecord-nulldb-adapter'
77

88
gem 'nochmal', github: 'puzzle/nochmal'
99

1010
gem 'acts_as_tree'
1111
gem 'aws-sdk-s3', require: false
1212
gem 'bleib'
13-
gem 'bootsnap'
13+
gem 'bootsnap', '>= 1.4.6'
1414
gem 'cancancan'
15-
gem 'config'
15+
gem 'config', '>= 2.2.1'
1616
gem 'country_select'
1717
gem 'daemons'
1818
gem 'dalli'

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ DEPENDENCIES
575575
better_errors
576576
binding_of_caller
577577
bleib
578-
bootsnap
578+
bootsnap (>= 1.4.6)
579579
bootstrap-sass
580580
brakeman
581581
bullet
@@ -585,7 +585,7 @@ DEPENDENCIES
585585
chartjs-ror
586586
codez-tarantula
587587
coffee-rails
588-
config
588+
config (>= 2.2.1)
589589
country_select
590590
daemons
591591
dalli
@@ -619,7 +619,7 @@ DEPENDENCIES
619619
omniauth-rails_csrf_protection
620620
omniauth-saml
621621
paper_trail
622-
pg (~> 0.21.0)
622+
pg (= 0.21.0)
623623
prawn
624624
prometheus_exporter
625625
protective

config/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Application < Rails::Application
6060

6161
memcached_host = ENV['RAILS_MEMCACHED_HOST'] || 'localhost'
6262
memcached_port = ENV['RAILS_MEMCACHED_PORT'] || '11211'
63-
config.cache_store = :dalli_store, "#{memcached_host}:#{memcached_port}"
63+
config.cache_store = :mem_cache_store, "#{memcached_host}:#{memcached_port}"
6464

6565
config.middleware.insert_before Rack::ETag, Rack::Deflater
6666

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11
# Be sure to restart your server when you modify this file.
22

3-
def dalli_reachable?
4-
Rails.cache.dalli.stats.values.any?
3+
def cache_reachable?
4+
Rails.cache.stats.values.any?
55
end
66

77
def memcache_configured?
88
if Rails.env.production?
99
ENV['RAILS_MEMCACHED_HOST'].present?
10-
elsif Rails.env.development?
11-
true
1210
else
13-
false
11+
Rails.env.development?
1412
end
1513
end
1614

15+
def skip_memcache_check
16+
ENV['SKIP_MEMCACHE_CHECK'].present?
17+
end
18+
1719
secure_cookies = !(Rails.env.development? || Rails.env.test?)
1820

1921
Rails.application.config.session_store ActionDispatch::Session::CacheStore,
2022
expire_after: 12.hours,
2123
same_site: :lax,
2224
secure: secure_cookies
2325

24-
# We expect memcache to work in production. Prevents an error with the rails console on OpenShift
25-
if memcache_configured? && !Rails.env.production? && !dalli_reachable?
26+
# We expect memcache to work in production.
27+
# Prevents an error with the rails console on OpenShift
28+
if !skip_memcache_check &&
29+
memcache_configured? &&
30+
!Rails.env.production? &&
31+
!cache_reachable?
2632
fail "As CSRF tokens are read from cache, we require a memcache instance to start"
2733
end

0 commit comments

Comments
 (0)