DEV: add warning if force_https in dev

This commit is contained in:
Sam 2016-11-25 11:35:18 +11:00
parent bc6ee85850
commit 3bec128f5f
1 changed files with 10 additions and 5 deletions

View File

@ -2,13 +2,18 @@
# #
require_dependency 'discourse_cookie_store' require_dependency 'discourse_cookie_store'
if Rails.env == "development" && SiteSetting.force_https
STDERR.puts
STDERR.puts "WARNING: force_https is enabled in dev"
STDERR.puts "It is very unlikely you are running HTTPS in dev."
STDERR.puts "Without HTTPS your session cookie will not work"
STDERR.puts "Try: bin/rails c"
STDERR.puts "SiteSetting.force_https = false"
STDERR.puts
end
Discourse::Application.config.session_store( Discourse::Application.config.session_store(
:discourse_cookie_store, :discourse_cookie_store,
key: '_forum_session', key: '_forum_session',
path: (Rails.application.config.relative_url_root.nil?) ? '/' : Rails.application.config.relative_url_root path: (Rails.application.config.relative_url_root.nil?) ? '/' : Rails.application.config.relative_url_root
) )
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# Discourse::Application.config.session_store :active_record_store