Skip to content

Commit

Permalink
Merge pull request #2 from openclimatefix/port-config
Browse files Browse the repository at this point in the history
Make port configurable
  • Loading branch information
devsjc authored Jan 8, 2024
2 parents eee0442 + a258229 commit 7c1cf90
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ FROM gcr.io/distroless/python3-debian12
COPY --from=build-app /venv /venv
WORKDIR /app
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
CMD curl -f http://localhost:${PORT}/health || exit 1
ENTRYPOINT ["/venv/bin/india-api"]

3 changes: 2 additions & 1 deletion src/india_api/cmd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

match cfg.SOURCE:
case "dummydb":

def get_db_client_override() -> internal.DatabaseInterface:
return internal.inputs.dummydb.Client()
case _:
Expand All @@ -25,7 +26,7 @@ def run() -> None:
uvicorn.run(
server,
host="0.0.0.0",
port=8000,
port=cfg.PORT,
reload=False,
log_level="debug",
workers=1,
Expand Down
3 changes: 2 additions & 1 deletion src/india_api/internal/config/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ def __init__(self) -> None:
# Cast to desired type
self.__setattr__(field, t(env_value))


class Config(EnvParser):
"""Config for the application."""

SOURCE: str = "dummydb"

PORT: int = 8000

0 comments on commit 7c1cf90

Please sign in to comment.