-
Notifications
You must be signed in to change notification settings - Fork 3
Fix frontend sentry configuration #1362
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
Changes from all commits
4f5457b
3e6c1bc
e314a8a
72b752e
de5f449
bb03662
5522610
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,7 +1,7 @@ | ||
| /* eslint-disable @typescript-eslint/no-var-requires */ | ||
| const path = require("path") | ||
|
|
||
| if (process.env.ENVIRONMENT === "local") { | ||
| if (process.env.LOAD_ENV_FILES?.toLowerCase() === "true") { | ||
| console.info("Loading environment from .env files") | ||
| require("dotenv").config({ | ||
| path: [ | ||
|
|
@@ -26,7 +26,6 @@ const ReactRefreshWebpackPlugin = require("@pmmmwh/react-refresh-webpack-plugin" | |
| const { cleanEnv, str, bool, port } = require("envalid") | ||
|
|
||
| const { | ||
| ENVIRONMENT, | ||
| NODE_ENV, | ||
| PORT, | ||
| VERSION, | ||
|
|
@@ -41,10 +40,6 @@ const { | |
| CKEDITOR_UPLOAD_URL, | ||
| SENTRY_DSN, | ||
| } = cleanEnv(process.env, { | ||
| ENVIRONMENT: str({ | ||
| choices: ["local", "docker", "production"], | ||
| default: "production", | ||
| }), | ||
|
Comment on lines
-44
to
-47
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. I think this variable was confusing. The The only thing this variable was used for is "Should webpack load env files itself"—that's usually not necessary because docker handles it. It is useful if you're running webpack locally outside of docker, so LOAD_ENV_FILES handles that now. 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. Yes - better to provide flags for specific behaviors where there is little distinction for environments / sets of values. Is 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. It is, though as you've mentioned there are issues running against RC with an authenticated user. |
||
| NODE_ENV: str({ | ||
| choices: ["development", "production", "test"], | ||
| default: "production", | ||
|
|
@@ -94,6 +89,10 @@ const { | |
| desc: "Location of the CKEditor uploads handler", | ||
| default: "", | ||
| }), | ||
| SENTRY_ENV: str({ | ||
| desc: "A label for the environment used for grouping errors in Sentry", | ||
| default: "", | ||
| }), | ||
| SENTRY_DSN: str({ | ||
| desc: "Sentry Data Source Name", | ||
| default: "", | ||
|
|
@@ -216,7 +215,6 @@ module.exports = (env, argv) => { | |
| MITOPEN_API_BASE_URL: JSON.stringify(MITOPEN_API_BASE_URL), | ||
| EMBEDLY_KEY: JSON.stringify(EMBEDLY_KEY), | ||
| CKEDITOR_UPLOAD_URL: JSON.stringify(CKEDITOR_UPLOAD_URL), | ||
| ENVIRONMENT: JSON.stringify(ENVIRONMENT), | ||
| VERSION: JSON.stringify(VERSION), | ||
| SENTRY_DSN: JSON.stringify(SENTRY_DSN), | ||
| POSTHOG: getPostHogSettings(), | ||
|
|
@@ -238,7 +236,7 @@ module.exports = (env, argv) => { | |
| : [new ReactRefreshWebpackPlugin()], | ||
| ) | ||
| .concat( | ||
| ENVIRONMENT !== "local" && WEBPACK_ANALYZE === "True" | ||
| WEBPACK_ANALYZE | ||
| ? [ | ||
| new BundleAnalyzerPlugin({ | ||
| analyzerMode: "static", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Get VERSION from settings.py | ||
| grep -Eo -m 1 'VERSION\s+= .*(\d+)\.\d+\.\d+.*' main/settings.py | | ||
| head -1 | | ||
| grep -Eo "\d+\.\d+\.\d+" | ||
|
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. This is not ideal. With For using VERSION during the github action, the options I see are:
(3) would be my preference, though I know we are reluctant to update doof much. 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. If settings.py is canonical, it's ok to extract it from there (by any means!). I agree that 3 is nicer. It would be useful to also write this to a version.txt file for the front end build as we do with: |
||
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.
Actions environments would be an improvement here so we are not having env vars that include the environment name - the job would run in the environment context. Outside of the scope of this PR though, given there are others.
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.
For us, it is quite canonical. All of our repos have it, and Doof updates it automatically during release via https://github.com/mitodl/release-script/blob/b44bb831e78a5450e3b09e502fd8733b454157f0/version.py#L120