Skip to content

Commit b32ef21

Browse files
authored
fix: Correct API URLs in Swagger docs (jordan-dimov#20)
1 parent 9b8b890 commit b32ef21

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

ctenex/api/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
host = settings.api.api_host
1515
port = settings.api.api_port
16+
base_url = str(settings.api.base_url)
1617

1718
app = create_app(routers=[])
1819

@@ -21,14 +22,14 @@
2122
lifespan=lifespan,
2223
routers=[status_router, stateful_exchange_router],
2324
)
24-
stateful_app_url = f"http://{host}:{port}{stateful_app_path}"
25+
stateful_app_url = f"{base_url}{stateful_app_path}"
2526
app.mount(stateful_app_path, stateful_app)
2627

2728
stateless_app_path = "/v1/stateless/"
2829
stateless_app = create_app(
2930
routers=[status_router, stateless_exchange_router],
3031
)
31-
stateless_app_url = f"http://{host}:{port}{stateless_app_path}"
32+
stateless_app_url = f"{base_url}{stateless_app_path}"
3233
app.mount(stateless_app_path, stateless_app)
3334

3435

ctenex/settings/api.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pydantic import Field, IPvAnyAddress
1+
from pydantic import Field, HttpUrl, IPvAnyAddress
22

33
from ctenex.settings.base import CommonSettings
44

@@ -8,4 +8,8 @@ class APISettings(CommonSettings):
88
validation_alias="API_HOST",
99
default=IPvAnyAddress("0.0.0.0"), # type: ignore
1010
)
11-
api_port: int = Field(validation_alias="API_PORT", default=3000)
11+
api_port: int = Field(validation_alias="API_PORT", default=8000)
12+
base_url: HttpUrl = Field(
13+
validation_alias="BASE_URL",
14+
default=HttpUrl("http://localhost:8000"),
15+
)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "ctenex"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
description = ""
55
authors = [
66
{name = "Your Name",email = "you@example.com"}

0 commit comments

Comments
 (0)