Skip to content

Commit

Permalink
feat: add dynamic logging to js bootstrapper (#152)
Browse files Browse the repository at this point in the history
To allow setting the log level dynamically, add a `/api/v0/nodejs/debug`
endpoint to the RPC server and curl to the docker image.

Set the log level with:

```
curl http://127.0.0.1:8899/api/v0/nodejs/log?namespace=libp2p*
```

Disable logging entirely with:

```
curl http://127.0.0.1:8899/api/v0/nodejs/log?namespace=
```

Also refactors the RPC server handlers into a Record to remove the
growing if/else if/else if.
  • Loading branch information
achingbrain authored Sep 24, 2024
1 parent 5ad7d04 commit 2493b1b
Show file tree
Hide file tree
Showing 4 changed files with 340 additions and 278 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM --platform=${BUILDPLATFORM} node:20-slim as builder

# Install dependencies required for building the app
RUN apt-get update && \
apt-get install -y tini && \
apt-get install -y tini curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

Expand All @@ -22,6 +22,7 @@ WORKDIR /app

COPY --from=builder /app ./
COPY --from=builder /usr/bin/tini /usr/bin/tini
COPY --from=builder /usr/bin/curl /usr/bin/curl

HEALTHCHECK --interval=60s --timeout=30s --start-period=10s CMD node dist/src/health-check.js

Expand Down
Loading

0 comments on commit 2493b1b

Please sign in to comment.