-
Notifications
You must be signed in to change notification settings - Fork 89
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
chore(frontend): remix v2 upgrade #2349
Changes from 1 commit
094e6f0
28d892b
ef8760a
6228d2c
ca9ad2c
38cfb94
6ded4de
1506658
00f4874
85b386a
3b32e7b
d45879b
91c22ca
95870de
b7e53ea
47ee050
adda951
3beabe9
3d115f3
50d51c6
37f5fa8
1a3bacb
32e29c1
29c4a24
9969315
0c660ae
8250581
41673bb
f7149aa
632ad8c
7a6ad8b
6b72997
fb4e5b7
dab6502
2db091c
b35dc09
a51f877
58fb5e4
93c8318
230d57e
e358d16
05f65f6
eaaee0e
455ebb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,5 +1,6 @@ | ||||||||||||||||||||
import { type Session, type SessionData, redirect } from '@remix-run/node' | ||||||||||||||||||||
import { createCookieSessionStorage } from '@remix-run/node' | ||||||||||||||||||||
import { parseBool } from '~/shared/utils' | ||||||||||||||||||||
|
||||||||||||||||||||
const ONE_MINUTE_IN_S = 60 | ||||||||||||||||||||
|
||||||||||||||||||||
|
@@ -20,10 +21,9 @@ export const messageStorage = createCookieSessionStorage< | |||||||||||||||||||
sameSite: 'lax', | ||||||||||||||||||||
maxAge: ONE_MINUTE_IN_S, | ||||||||||||||||||||
secrets: ['MY_SUPER_SECRET_TOKEN'], | ||||||||||||||||||||
secure: | ||||||||||||||||||||
process.env.COOKIE_SECURE === undefined | ||||||||||||||||||||
? true | ||||||||||||||||||||
: ['true', 't', '1'].includes(process.env.COOKIE_SECURE.toLowerCase()) | ||||||||||||||||||||
secure: process.env.ENABLE_INSECURE_MESSAGE_COOKIE | ||||||||||||||||||||
? !parseBool(process.env.ENABLE_INSECURE_MESSAGE_COOKIE) | ||||||||||||||||||||
: process.env.NODE_ENV === 'production' | ||||||||||||||||||||
Comment on lines
+24
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added so that we dont have to run in development mode to set this to insecure. Basically, you can pass in this means it's secure by default for production use and when running in dev mode we dont need to set for good measure here's a state table:
|
||||||||||||||||||||
} | ||||||||||||||||||||
}) | ||||||||||||||||||||
|
||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the
ENABLE_INSECURE_MESSAGE_COOKIE
should be passed as a build argument in the compose file.ENABLE_INSECURE_MESSAGE_COOKIE
will betrue
when starting the frontend application every time (for everyone that is going to use Rafiki's frontend image), since we use this specific Dockerfile to build the image.https://docs.docker.com/compose/compose-file/compose-file-v3/#args
I experimented with this method and it appears to be effective for me. I would greatly appreciate any additional feedback on it to see if it works for everyone since I'm not entirely sure about this approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above approach might not even be necessary, we can just get rid of the inline environment variables and specify the value for
ENABLE_INSECURE_MESSAGE_COOKIE
in the compose files. Setting the value of the environment variable before a command, it will replace the value that was previously set in the compose file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point - I will move it to the compose.
I can also remove
NODE_ENV=production
from the frontend dockerfile but not necessarily the MASE because those are set to development by compose. I take the point that we shouldn't set it here. Maybe I can removeNODE_ENV=development
from the compose for the MASE.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the development NODE_ENV from the MASE's in the docker compose and removed the inline env var from the dockerfile. MASE's start fine and look normal - audited for any NODE_ENV checks in the MASE and there are none so there seems to be no problem with that. b35dc09