Skip to content

Commit

Permalink
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions backend/src/appointment/defines.py
Original file line number Diff line number Diff line change
@@ -8,3 +8,5 @@

APP_ENV_DEV = 'dev'
APP_ENV_TEST = 'test'
APP_ENV_STAGE = 'stage'
APP_ENV_PROD = 'prod'
10 changes: 5 additions & 5 deletions backend/src/appointment/main.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
from starlette_context.middleware import RawContextMiddleware
from fastapi import Request

from .defines import APP_ENV_DEV, APP_ENV_TEST
from .defines import APP_ENV_DEV, APP_ENV_TEST, APP_ENV_STAGE, APP_ENV_PROD
from .middleware.l10n import L10n
from .middleware.SanitizeMiddleware import SanitizeMiddleware
# Ignore "Module level import not at top of file"
@@ -68,12 +68,12 @@ def _common_setup():

sample_rate = 0
profile_traces_max = 0
environment = os.getenv("APP_ENV", "stage")
environment = os.getenv("APP_ENV", APP_ENV_STAGE)

if environment == 'stage':
if environment == APP_ENV_STAGE:
profile_traces_max = 0.25
sample_rate = 1.0
elif environment == 'production':
elif environment == APP_ENV_PROD:
profile_traces_max = 0.25
sample_rate = 1.0

@@ -125,7 +125,7 @@ def server():
from .routes import webhooks

# Hide openapi url (which will also hide docs/redoc) if we're not dev
openapi_url = '/openapi.json' if os.getenv('APP_ENV') == 'dev' else None
openapi_url = '/openapi.json' if os.getenv('APP_ENV') == APP_ENV_DEV else None

# init app
app = FastAPI(openapi_url=openapi_url)
3 changes: 2 additions & 1 deletion backend/src/appointment/migrations/env.py
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@

from alembic import context

from appointment.defines import APP_ENV_DEV
# This is ran from src/ so ignore the errors
from appointment.secrets import normalize_secrets

@@ -42,7 +43,7 @@
# of transactions for performance monitoring.
# We recommend adjusting this value in production,
traces_sample_rate=1.0,
environment=os.getenv("APP_ENV", "dev"),
environment=os.getenv("APP_ENV", APP_ENV_DEV),
)


0 comments on commit 202d5d6

Please sign in to comment.