Skip to content

Commit

Permalink
feat: enable transactions extension for demo (#276)
Browse files Browse the repository at this point in the history
This PR enables transactions for with automatic secret lookup. The goal
here is not to expose this feature to end-users, so no further auth is
involved.

Closes #269
  • Loading branch information
moradology authored Jan 23, 2024
2 parents 9a55ad4 + 3b34fbd commit b4f8a7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stac_api/runtime/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
CORSMiddleware,
allow_origins=api_settings.cors_origins,
allow_credentials=True,
allow_methods=["GET", "POST", "OPTIONS"],
allow_methods=["GET", "POST", "PUT", "OPTIONS"],
allow_headers=["*"],
)

Expand Down
10 changes: 8 additions & 2 deletions stac_api/runtime/src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@
import boto3
import pydantic

from fastapi.responses import ORJSONResponse
from stac_fastapi.api.models import create_get_request_model, create_post_request_model

# from stac_fastapi.pgstac.extensions import QueryExtension
from stac_fastapi.extensions.core import (
ContextExtension,
FieldsExtension,
FilterExtension,
QueryExtension,
SortExtension,
TokenPaginationExtension,
TransactionExtension,
)
from stac_fastapi.pgstac.config import Settings
from stac_fastapi.pgstac.transactions import TransactionsClient
from stac_fastapi.pgstac.types.search import PgstacSearch


Expand Down Expand Up @@ -126,6 +127,11 @@ def TilesApiSettings() -> _TilesApiSettings:
FieldsExtension(),
TokenPaginationExtension(),
ContextExtension(),
TransactionExtension(
client=TransactionsClient(),
settings=ApiSettings().load_postgres_settings(),
response_class=ORJSONResponse,
),
]
post_request_model = create_post_request_model(extensions, base_model=PgstacSearch)
get_request_model = create_get_request_model(extensions)

0 comments on commit b4f8a7e

Please sign in to comment.