Remove DEV_MODE and USE_FAKE_FXA_AUTH, replace with PROD_MODE and FXA_CONFIG #23049
+432
−302
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.
Fixes: mozilla/addons#15331
Description
This commit introduces several changes to simplify and improve the authentication and environment configuration:
DEV_MODE
withPROD_MODE
derived from version JSON instead of environment variableUSE_FAKE_FXA_AUTH
setting replaced withFXA_CONFIG
to control fake authenticationContext
This patch simplifies the configuration of "prod" versus "dev" mode by relying on build time parameters that reliably inform what kind of server to run. Environment variables can be overwritten and have no direct connection to the build, but get_version_json can tell you exactly waht kind of image you are running.
Additionally, sometimes you want to run in prod mode, but don't want to setup a real authentication server. Now you can do that because we use a more granular check for fake FXA based on the presence of valid fxa credentials at runtime.
Testing
Dev mode
Run in dev mode
App should run in dev mode with debug toolbar and non compiled assets
Prod mode
Run in prod mode
Expect compiled assets, no debug toolbar (unless DEBUG=True is explicitly set)
and finally, fake fxa should still be used by default.
Real auth
To run with real auth you must set the environment variables
and run in either dev or prod mode. Try both.
Checklist
#ISSUENUM
at the top of your PR to an existing open issue in the mozilla/addons repository.