MNTOR-5089: Consolidate configuration settings #6324
+246
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References:
Jira: MNTOR-5089
Figma:
Description
This is a proposal for how to centralise our environment-specific configuration. If you both agree with this approach, I can do a sweep over the codebase for all references to
process.env, and replace them by references toconfig.One other thing we might consider is adopting
@next/envinstead ofdotenv-flow- behaviour should be the same I think, but then we're using the exact same code Next.js is using to load env vars, so that's technically one fewer dependency, and less risk of divergence. (Plus, I'm not sure if dotenv-flow is being very actively maintained, and we need a fix there for the Next.js upgrade.)How to test
I've included two examples where
configare used:/admin/dev. To verify that this works, access that page with an admin account locally, then run using e.g.APP_ENV="production" npm run devor by setting that in your.env.local, and verify that you now get a 404 on that page with the same account.npm run dev:cron:monthly-activity-free. Likewise, if you setMONTHLY_ACTIVITY_FREE_EMAIL_BATCH_SIZEto a value other than 10, you should see that referenced in the logs:Checklist (Definition of Done)