Skip to content
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

Remove DEV_MODE and USE_FAKE_FXA_AUTH, replace with PROD_MODE and FXA_CONFIG #23049

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KevinMind
Copy link
Contributor

@KevinMind KevinMind commented Feb 3, 2025

Fixes: mozilla/addons#15331

Description

This commit introduces several changes to simplify and improve the authentication and environment configuration:

  • Replaced DEV_MODE with PROD_MODE derived from version JSON instead of environment variable
  • Removed USE_FAKE_FXA_AUTH setting replaced with FXA_CONFIG to control fake authentication
  • Simplified conditional logic around development and production environments to rely on stable build time variables

Context

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

make up DOCKER_TARGET=development

App should run in dev mode with debug toolbar and non compiled assets

Prod mode

Run in prod mode

make up DOCKER_TARGET=production

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

FXA_CLIENT_ID=id
FXA_CLIENT_SECRET=secret

and run in either dev or prod mode. Try both.

Checklist

  • Add #ISSUENUM at the top of your PR to an existing open issue in the mozilla/addons repository.
  • Successfully verified the change locally.
  • The change is covered by automated tests, or otherwise indicated why doing so is unnecessary/impossible.
  • Add before and after screenshots (Only for changes that impact the UI).
  • Add or update relevant docs reflecting the changes made.

@KevinMind KevinMind requested review from a team and diox and removed request for a team February 3, 2025 16:40
@KevinMind KevinMind force-pushed the fake-fxa-auth branch 4 times, most recently from 0928b7f to 2731dee Compare February 3, 2025 21:03
…_CONFIG

This commit introduces several changes to simplify and improve the authentication and environment configuration:

- Replaced `DEV_MODE` with `PROD_MODE` derived from version JSON instead of environment variable
- Removed `USE_FAKE_FXA_AUTH` setting replaced with `FXA_CONFIG` to control fake authentication
- Simplified conditional logic around development and production environments to rely on stable build time variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Enable fake FXA in local production images
1 participant