Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
SECRET_KEY=insecure-secret-key
LOGIN_CODE_SECRET=insecure-login-secret-key

LOG_LEVEL=DEBUG
APP_ENV=dev
APP_DEBUG=True
PUBLIC_BASE_URL=http://localhost:8087
Expand Down
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
SECRET_KEY=insecure-secret-key
LOGIN_CODE_SECRET=insecure-login-secret-key

LOG_LEVEL=DEBUG
APP_ENV=test
PUBLIC_BASE_URL=http://localhost:8087

Expand Down
6 changes: 6 additions & 0 deletions pulumi/config.prod.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---

### Special variables used throughout this file
.log_level: &VAR_LOG_LEVEL {name: "LOG_LEVEL", "value": "INFO"}

resources:

domains:
Expand Down Expand Up @@ -462,6 +466,7 @@ resources:
value: '44379263732755'
- name: VERIFY_PRIVATE_LINK_SSL
value: 'False'
- *VAR_LOG_LEVEL


accounts-celery:
Expand Down Expand Up @@ -643,6 +648,7 @@ resources:
value: '44379263732755'
- name: VERIFY_PRIVATE_LINK_SSL
value: 'False'
- *VAR_LOG_LEVEL

tb:autoscale:EcsServiceAutoscaler:
accounts:
Expand Down
4 changes: 4 additions & 0 deletions pulumi/config.stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
.imap_host: &VAR_IMAP_HOST {name: "IMAP_HOST", value: "mail.stage-thundermail.com"}
.imap_port: &VAR_IMAP_PORT {name: "IMAP_PORT", value: "993"}
.imap_tls: &VAR_IMAP_TLS {name: "IMAP_TLS", value: "True"}
.log_level: &VAR_LOG_LEVEL {name: "LOG_LEVEL", "value": "DEBUG"}
.keycloak_url_api: &VAR_KEYCLOAK_URL_API {name: "KEYCLOAK_URL_API", value: "https://auth-stage.tb.pro/admin/realms/tbpro/"}
.keycloak_admin_url_token: &VAR_KEYCLOAK_ADMIN_URL_TOKEN {name: "KEYCLOAK_ADMIN_URL_TOKEN", value: "https://auth-stage.tb.pro/realms/master/protocol/openid-connect/token/"}
.jmap_host: &VAR_JMAP_HOST {name: "JMAP_HOST", value: "mail.stage-thundermail.com"}
Expand Down Expand Up @@ -379,6 +380,7 @@ resources:
- *VAR_ZENDESK_FORM_ID
- *VAR_ZENDESK_FORM_BROWSER_FIELD_ID
- *VAR_ZENDESK_FORM_OS_FIELD_ID
- *VAR_LOG_LEVEL
- name: TBA_CELERY
value: "yes"
- name: TBA_FLOWER
Expand Down Expand Up @@ -449,6 +451,7 @@ resources:
- *VAR_ZENDESK_FORM_ID
- *VAR_ZENDESK_FORM_BROWSER_FIELD_ID
- *VAR_ZENDESK_FORM_OS_FIELD_ID
- *VAR_LOG_LEVEL
- name: TBA_CELERY
value: "no"
- name: TBA_FLOWER
Expand Down Expand Up @@ -846,6 +849,7 @@ resources:
value: '46642417675539'
- name: VERIFY_PRIVATE_LINK_SSL
value: 'False'
- *VAR_LOG_LEVEL

tb:autoscale:EcsServiceAutoscaler:
accounts:
Expand Down
8 changes: 6 additions & 2 deletions src/thunderbird_accounts/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import os
import sys
from pathlib import Path
from importlib.metadata import version

from dotenv import load_dotenv
import sentry_sdk
Expand Down Expand Up @@ -41,6 +42,8 @@

IS_DOCS = APP_ENV == 'docs'
IS_DEV = APP_ENV == 'dev'
IS_STAGE = APP_ENV == 'stage'
IS_PROD = APP_ENV == 'prod'

# Only allow DEBUG on dev or test envs.
DEBUG: bool = os.getenv('APP_DEBUG') == 'True' and (IS_DEV or APP_ENV == 'test')
Expand All @@ -67,10 +70,11 @@ def before_send(event: Event, hint: Hint) -> Event | None:
# see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
send_default_pii=False,
traces_sample_rate=1.0,
profiles_sample_rate=1.0,
profiles_sample_rate=0.66 if IS_PROD else 0.25, # Match Appointment's profile sample rate
environment=APP_ENV,
before_send=before_send,
attach_stacktrace=True,
release=version('thunderbird_accounts'),
)

# Build paths inside the project like this: BASE_DIR / 'subdir'.
Expand Down Expand Up @@ -314,7 +318,7 @@ def before_send(event: Event, hint: Hint) -> Event | None:
},
'root': {
'handlers': ['console'],
'level': 'DEBUG',
'level': os.getenv('LOG_LEVEL', 'INFO'),
},
'loggers': {
# Reduce spam logs
Expand Down