Skip to content

Commit

Permalink
Update GET/POST affiliation endpoints to support sandbox env
Browse files Browse the repository at this point in the history
  • Loading branch information
sameer0422 committed Dec 23, 2024
1 parent be50e07 commit d6d12db
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions auth-api/src/auth_api/utils/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,15 @@ def mask_email(email: str) -> str:

def get_request_environment():
"""Return the environment corresponding to the user request."""
env = None
sandbox_host = current_app.config["AUTH_WEB_SANDBOX_HOST"]
if os.getenv("FLASK_ENV") == "production" and sandbox_host in request.host_url:
env = "sandbox"
return env
env_override = request.headers.get('Environment-Override')
sandbox_host = current_app.config.get("AUTH_WEB_SANDBOX_HOST")
is_production = os.getenv("FLASK_ENV") == "production"

if env_override:
return env_override
if is_production and sandbox_host in request.host_url:
return "sandbox"
return None


def extract_numbers(input_string: str):
Expand Down

0 comments on commit d6d12db

Please sign in to comment.