From b6f9bf139c69c358536f4e6aed7d62a41a47f3b3 Mon Sep 17 00:00:00 2001 From: Vincent Duchauffour Date: Thu, 13 Nov 2025 17:50:56 +0100 Subject: [PATCH] fix: fix host and port for development --- .env.example | 3 ++- compose.yaml | 13 +++++++------ scripts/github_app.py | 2 +- src/fastgithub/endpoint/webhook_router.py | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index 9394c1b..d2184aa 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,4 @@ WEBHOOK_PROXY_URL= GITHUB_TOKEN= -GITHUB_WEBHOOK_SECRET= \ No newline at end of file +GITHUB_WEBHOOK_SECRET= +GITHUB_WEBHOOK_PATH= \ No newline at end of file diff --git a/compose.yaml b/compose.yaml index aea7bb2..bf1ffe3 100644 --- a/compose.yaml +++ b/compose.yaml @@ -12,6 +12,7 @@ services: environment: - GITHUB_TOKEN=$GITHUB_TOKEN - GITHUB_WEBHOOK_SECRET=$GITHUB_WEBHOOK_SECRET + - GITHUB_WEBHOOK_PATH=$GITHUB_WEBHOOK_PATH entrypoint: - uv - run @@ -19,6 +20,10 @@ services: - dev - scripts/github_app.py - --reload + - --host + - 0.0.0.0 + - --port + - "8000" # taken from https://docs.astral.sh/uv/guides/integration/docker/#configuring-watch-with-docker-compose develop: watch: @@ -34,14 +39,10 @@ services: depends_on: - app restart: always - ports: - - 3000:3000 environment: - WEBHOOK_PROXY_URL=$WEBHOOK_PROXY_URL command: - --url - $WEBHOOK_PROXY_URL - - --path - - /post-receive - - --port - - '8000' + - --target + - http://app:8000$GITHUB_WEBHOOK_PATH diff --git a/scripts/github_app.py b/scripts/github_app.py index f143a64..48cd159 100644 --- a/scripts/github_app.py +++ b/scripts/github_app.py @@ -19,7 +19,7 @@ app = FastAPI() -router = webhook_router(handler=webhook_handler, path="/post-receive") +router = webhook_router(handler=webhook_handler, path=os.environ["GITHUB_WEBHOOK_PATH"]) app.include_router(router) if __name__ == "__main__": diff --git a/src/fastgithub/endpoint/webhook_router.py b/src/fastgithub/endpoint/webhook_router.py index 50bd03e..5d90272 100644 --- a/src/fastgithub/endpoint/webhook_router.py +++ b/src/fastgithub/endpoint/webhook_router.py @@ -10,7 +10,7 @@ def webhook_router( handler: GithubWebhookHandler, - path: str = "", + path: str, dependencies: Sequence[Callable] | None = None, include_in_schema: bool = True, tags: list[str | Enum] | None = None,