Skip to content

Commit

Permalink
revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixTJDietrich committed Aug 20, 2024
1 parent 2df0da3 commit 7de69ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 2 additions & 4 deletions server/webhook-ingest/app/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,5 @@ def __init__(
def filter(self, record: logging.LogRecord) -> bool:
return record.getMessage().find(self._path) == -1

access_logger = logging.getLogger("uvicorn.access")
access_logger.addFilter(EndpointFilter(path="/health"))

error_logger = logging.getLogger('uvicorn.error')
uvicorn_logger = logging.getLogger("uvicorn.access")
uvicorn_logger.addFilter(EndpointFilter(path="/health"))
11 changes: 5 additions & 6 deletions server/webhook-ingest/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from nats.js.api import StreamConfig
from app.config import settings
from app.nats_client import nats_client
from app.logger import error_logger


@asynccontextmanager
Expand Down Expand Up @@ -50,19 +49,19 @@ async def github_webhook(
if event_type == "ping":
return { "status": "pong" }

payload = await request.json()

# Extract subject from the payload
try:
payload = await request.json()
subject = ""
if "repository" in payload:
owner = payload["repository"]["owner"]["login"]
repo = payload["repository"]["name"]
subject = f"github.{owner}.{repo}.{event_type}"
except:
else:
subject = f"github.error.{event_type}"

# Publish the payload to NATS JetStream
await nats_client.js.publish(subject, body)

return { "status": "ok" }


Expand Down

0 comments on commit 7de69ea

Please sign in to comment.