@@ -26,24 +26,23 @@ class Application < Rails::Application
26
26
# Initialize configuration defaults for originally generated Rails version.
27
27
config . load_defaults 6.1
28
28
29
- # API Only application. This should remain at the top
30
- config . api_only = false # FIXME revert to true one day when the tests start working again
29
+ # API Only application. This should remain near the top (below the load_defaults of course)
30
+ # See also https://guides.rubyonrails.org/api_app.html#changing-an-existing-application for
31
+ # some of what needs to be done for api_only apps.
32
+ config . api_only = true
31
33
34
+ # See: https://github.com/rails/rails/blob/3c9d7a268f325f5cc6ab1ab49aed6f52e4c4f631/guides/source/api_app.md#using-session-middlewares.
32
35
# Add cookie middleware (included by default in non api_only applications)
36
+ # See the relevant section of https://guides.rubyonrails.org/v6.1/configuring.html#rails-general-configuration
33
37
# This also configures session_options for use below
34
- config . session_store :cookie_store , key : '_interslice_session'
38
+ config . session_store :cookie_store
35
39
36
- # See: https://github.com/rails/rails/blob/3c9d7a268f325f5cc6ab1ab49aed6f52e4c4f631/guides/source/api_app.md#using-session-middlewares.
37
40
# Required for all session management (regardless of session_store)
38
41
config . middleware . use ActionDispatch ::Cookies
39
- # config.session_options[:secure] = Rails.env.production? # TODO make sure that asserting this config in production.rb works with the following line.
42
+ # Enable HTTPS-only session cookies in production
43
+ config . session_options [ :secure ] = Rails . env . production?
40
44
config . middleware . use config . session_store , config . session_options
41
45
42
- # Add session middleware (included by default in non api_only applications)
43
- config . middleware . use ActionDispatch ::Session ::CookieStore
44
- # TODO not sure if it's helpful, from https://stackoverflow.com/a/61238872/7309070
45
- config . middleware . insert_after ( ActionDispatch ::Cookies , ActionDispatch ::Session ::CookieStore )
46
-
47
46
# Settings in config/environments/* take precedence over those specified here.
48
47
# Application configuration can go into files in config/initializers
49
48
# -- all .rb files in that directory are automatically loaded after loading
0 commit comments