Skip to content

Commit 647cf3e

Browse files
committed
upgrade to tipg==0.10.1 and titiler-pgstac==1.7.1
1 parent 0398177 commit 647cf3e

File tree

4 files changed

+27
-33
lines changed

4 files changed

+27
-33
lines changed

lib/tipg-api/runtime/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
tipg==0.9.0
1+
tipg==0.10.1

lib/tipg-api/runtime/src/handler.py

+14-19
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,26 @@
66
import os
77

88
from mangum import Mangum
9+
from tipg.collections import register_collection_catalog
10+
from tipg.database import connect_to_db
11+
from tipg.main import app
12+
from tipg.settings import (
13+
CustomSQLSettings,
14+
DatabaseSettings,
15+
PostgresSettings,
16+
)
917
from utils import get_secret_dict
1018

1119
secret = get_secret_dict(secret_arn_env_var="PGSTAC_SECRET_ARN")
12-
os.environ.update(
13-
{
14-
"postgres_host": secret["host"],
15-
"postgres_dbname": secret["dbname"],
16-
"postgres_user": secret["username"],
17-
"postgres_pass": secret["password"],
18-
"postgres_port": str(secret["port"]),
19-
}
20-
)
2120

22-
from tipg.collections import register_collection_catalog # noqa: E402
23-
from tipg.database import connect_to_db # noqa: E402
2421

25-
# skipping linting rule that wants all imports at the top
26-
from tipg.main import app # noqa: E402
27-
from tipg.settings import (
28-
CustomSQLSettings, # noqa: E402
29-
DatabaseSettings, # noqa: E402
30-
PostgresSettings, # noqa: E402; noqa: E402
22+
postgres_settings = PostgresSettings(
23+
postgres_host=secret["host"],
24+
postgres_dbname=secret["dbname"],
25+
postgres_user=secret["username"],
26+
postgres_pass=secret["password"],
27+
postgres_port=str(secret["port"]),
3128
)
32-
33-
postgres_settings = PostgresSettings()
3429
db_settings = DatabaseSettings()
3530
custom_sql_settings = CustomSQLSettings()
3631

Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
titiler.pgstac==1.7.0
1+
titiler.pgstac==1.7.1
22
psycopg[binary, pool]

lib/titiler-pgstac-api/runtime/src/handler.py

+11-12
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,26 @@
66
import os
77

88
from mangum import Mangum
9+
from titiler.pgstac.db import connect_to_db
10+
from titiler.pgstac.main import app
11+
from titiler.pgstac.settings import PostgresSettings
912
from utils import get_secret_dict
1013

1114
secret = get_secret_dict(secret_arn_env_var="PGSTAC_SECRET_ARN")
12-
os.environ.update(
13-
{
14-
"postgres_host": secret["host"],
15-
"postgres_dbname": secret["dbname"],
16-
"postgres_user": secret["username"],
17-
"postgres_pass": secret["password"],
18-
"postgres_port": str(secret["port"]),
19-
}
20-
)
2115

22-
from titiler.pgstac.db import connect_to_db # noqa: E402
23-
from titiler.pgstac.main import app # noqa: E402
16+
postgres_settings = PostgresSettings(
17+
postgres_host=secret["host"],
18+
postgres_dbname=secret["dbname"],
19+
postgres_user=secret["username"],
20+
postgres_pass=secret["password"],
21+
postgres_port=str(secret["port"]),
22+
)
2423

2524

2625
@app.on_event("startup")
2726
async def startup_event() -> None:
2827
"""Connect to database on startup."""
29-
await connect_to_db(app)
28+
await connect_to_db(app, settings=postgres_settings)
3029

3130

3231
handler = Mangum(app, lifespan="off")

0 commit comments

Comments
 (0)