Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BAU: Fix use of .env file for the dev-x.js stubs #2491

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ben-fernandes-sw
Copy link

What

This contains two changes:

Fix .env file not being read into dev-x local stubs

The dev-x.js files use dotenv to load environment variables. Therefore, they expect a .env file to exist in the /app directory in the Docker container. We weren't copying in the .env file, so the scripts were always falling back onto default values.

dev-x stubs use SESSION_EXPIRY as defined in .env file

There were two issues previously:

  1. When setting cookies in the stubs, we set the 'maxAge' as a datetime 1 hour in the future. This didn't have the intended effect though, as maxAge expects an integer of milliseconds, not a date as we were providing. 'expire' should be used to set expiry at a specific datetime.
  2. This is a moot point now though. The session expiry was hardcoded to an hour in the future. Now, it uses the SESSION_EXPIRY param as defined in the .env file.

The 'lng' cookie is still set to a year in the future, but that's because a library we use overwrites it.

How to review

  1. Code Review

The dev-x.js files use dotenv to load environment variables. Therefore, they expect a .env file to exist in the /app directory in the Docker container. We weren't copying in the .env file, so the scripts were always falling back onto default values.
There were two issues previously:
1) We set the 'maxAge' as a datetime 1 hour in the future. This didn't have the intended effect though, as maxAge expects an integer of milliseconds, not a date as we were providing. 'expire' should be used to set expiry at a specific datetime.
2) This is a moot point now though. The session expiry was hardcoded to an hour in the future. Now, it uses the SESSION_EXPIRY param as defined in the .env file.

The 'lng' cookie is still set to a year in the future, but that's because a library we use overwrites it.
@ben-fernandes-sw ben-fernandes-sw requested review from a team as code owners January 17, 2025 15:26
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.

1 participant