Skip to content

Refactor environment-specific session key and storage_id cookie constants#4267

Merged
wjordan merged 2 commits into
stagingfrom
session_key
Sep 30, 2015
Merged

Refactor environment-specific session key and storage_id cookie constants#4267
wjordan merged 2 commits into
stagingfrom
session_key

Conversation

@wjordan

@wjordan wjordan commented Sep 30, 2015

Copy link
Copy Markdown
Contributor

Our environment-specific cookie constants for session cookies ('_learn_session_ENV') and storage_id ('storage_id_ENV') were being generated in several places throughout our codebase. This PR refactors several of these instances into the Session::KEY and Session::STORAGE_ID constants to keep track of them a bit more easily moving forward.

Prerequisite to #4207.

Comment thread lib/cdo/session.rb Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doubly nested #{ #{ } #} are hard to read and repeated on two lines.

Could you change this to:
env_suffix = "_#{rack_env}" unless rack_env?(:production)
KEY = "_learn_session#{env_suffix}"
STORAGE_ID = "storage_id#{env_suffix}"

@philbogle

Copy link
Copy Markdown
Contributor

LGTM after comment is addressed.

wjordan added a commit that referenced this pull request Sep 30, 2015
Refactor environment-specific session key and storage_id cookie constants
@wjordan wjordan merged commit e5b2318 into staging Sep 30, 2015
@wjordan wjordan deleted the session_key branch September 30, 2015 21:28
deploy-code-org added a commit that referenced this pull request Sep 30, 2015
commit 61b0b53
Merge: e5b2318 c115392
Author: Chris Pirich <chris@code.org>
Date:   Wed Sep 30 14:40:35 2015 -0700

    Merge pull request #4273 from code-dot-org/playlab_annotations

    enable annotations for playlab, add clearRuntimeAnnotations()

commit e5b2318
Merge: aad7706 d3089ea
Author: Will Jordan <wjordan@users.noreply.github.com>
Date:   Wed Sep 30 14:28:56 2015 -0700

    Merge pull request #4267 from code-dot-org/session_key

    Refactor environment-specific session key and storage_id cookie constants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants