-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Read session store domain from config
- Loading branch information
Showing
3 changed files
with
17 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,8 @@ | ||
# Be sure to restart your server when you modify this file. | ||
# config/initializers/session_store.rb | ||
|
||
# Retrieve the session key name based on the environment using CheckConfig. | ||
# Provide default values specific to each environment. | ||
|
||
# Default keys by environment | ||
default_keys = { | ||
production: '_checkdesk_session', | ||
development: '_checkdesk_session_dev', | ||
test: '_checkdesk_session_test' | ||
} | ||
|
||
# Get the environment specific session key or default to a predefined value. | ||
cookie_key = CheckConfig.get('session_key', default_keys[Rails.env.to_sym]) | ||
|
||
# Set the domain for the session cookies based on the environment. | ||
domain_setting = Rails.env.development? ? 'localhost' : '.checkmedia.org' | ||
# Retrieve the session key and domain based on the environment using CheckConfig. | ||
cookie_key = CheckConfig.get('session_store_key', '_checkdesk_session') | ||
domain_setting = CheckConfig.get('session_store_domain', Rails.env.development? ? 'localhost' : '.checkmedia.org') | ||
|
||
# Configure the session store with the dynamically obtained session key and domain. | ||
Rails.application.config.session_store :cookie_store, key: cookie_key, domain: domain_setting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters