Skip to content

Commit 214de02

Browse files
authored
feat: add aws lambda handler (#81)
Ship with a Mangum handler.
1 parent 48afd7e commit 214de02

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ docs = [
3636
"mkdocs-material[imaging]>=9.6.16",
3737
"mkdocstrings[python]>=0.30.0",
3838
]
39+
lambda = [
40+
"mangum>=0.19.0",
41+
]
3942

4043
[tool.coverage.run]
4144
branch = true

src/stac_auth_proxy/lambda.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""Handler for AWS Lambda."""
2+
3+
from stac_auth_proxy import create_app
4+
5+
try:
6+
from mangum import Mangum
7+
except ImportError:
8+
raise ImportError(
9+
"mangum is required to use the Lambda handler. Install stac-auth-proxy[lambda]."
10+
)
11+
12+
13+
handler = Mangum(
14+
create_app(),
15+
# NOTE: lifespan="off" skips conformance check and upstream health checks on startup
16+
lifespan="off",
17+
)

uv.lock

Lines changed: 17 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)