Skip to content

Commit

Permalink
Add env variables for Sentry integration
Browse files Browse the repository at this point in the history
  • Loading branch information
elreplicante committed Jul 8, 2022
1 parent edc94fc commit aadad05
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ services:
target: api
volumes:
- ./data:/app/data
environment:
- ENVIRONMENT=${ENVIRONMENT:-development}
- SENTRY_OCR_DSN=${SENTRY_OCR_DSN:-}
ocr:
init: true
network_mode: host
Expand All @@ -22,6 +25,9 @@ services:
target: ocr
volumes:
- ./data:/app/data
environment:
- ENVIRONMENT=${ENVIRONMENT:-development}
- SENTRY_OCR_DSN=${SENTRY_OCR_DSN:-}

redis:
image: "redis:5.0.14"
Expand Down
7 changes: 3 additions & 4 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@

try:
sentry_sdk.init(
os.environ.get("SENTRY_OCR_DSN"),
os.environ.get('SENTRY_OCR_DSN'),
traces_sample_rate=0.1,
environment=os.environ.get("ENVIRONMENT", "development"),
)
environment=os.environ.get('ENVIRONMENT', 'development')
)
app.add_middleware(SentryAsgiMiddleware)
except Exception:
pass


@app.get("/info")
async def info():
logger.info("Ocr PDF info endpoint")
Expand Down

0 comments on commit aadad05

Please sign in to comment.