-
Notifications
You must be signed in to change notification settings - Fork 3
Moves all env vars to global APP_SETTINGS #1310
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
Conversation
… to APP_SETTINGS, properties renamed to align, supplied via envalid.
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.
@jonkafton Shouldn't all instances of process.env.whatever be replaced with APP_SETTINGS now? Except process.env.NODE_ENV, which is special—webpack strips out blocks that are process.env.NODE_ENV === "development".
I'm seeing several remaining process.env.SITE_NAME references. Could you update these and double check all other process.env. instances?
frontends/mit-open/webpack.config.js
Outdated
| }), | ||
| CKEDITOR_UPLOAD_URL: str({ | ||
| desc: "Location of the CKEditor uploads handler", | ||
| default: "https://35904.cke-cs.com/easyimage/upload/", |
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.
Not entirely sure we should commit this. It's not secret, since it is used on the frontend, but it is env specific.
Could add a dev default of a fake url 🤷
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've set it to an empty string, which disables the file upload option according to their docs.
Good spot, I missed that one somehow - now replaced.
Yes, all instances in the app code should be removed. Ok to use in tests, Storybook and the webpack config itself. We have dynamic env var names for the Posthog feature flags, for example. |
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.
👍

What are the relevant tickets?
Closes #1057
Description (What does it do?)
processobject in frontend code.Breaking change: We previously tolerated
MITOPEN_AXIOS_WITH_CREDENTIALS=Trueon the environment. This is now checked by envalid, which required that booleans are provided in lowercase,'true'.How can this be tested?
App builds, tests pass and things run.
Additional Context
We were using two mechanisms to provide build time environment variables to the frontend code. An
APP_SETTINGSobject provided by the Webpack DefinePlugin and others provided by the EnvironmentPlugin, which writes ontoprocess.envin the front end code (through string replacement, not the actual process object).The latter has often been the preferred method as it provides consistency between the build and for tests running in a Node.js process, however the process object is specific to Node.js and doesn't really belong in front end code. Webpack 5 removed its polyfill for the
processobject and recommends it be avoided.