Skip to content

Commit 2493b1b

Browse files
authored
feat: add dynamic logging to js bootstrapper (#152)
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.
1 parent 5ad7d04 commit 2493b1b

File tree

4 files changed

+340
-278
lines changed

4 files changed

+340
-278
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM --platform=${BUILDPLATFORM} node:20-slim as builder
22

33
# Install dependencies required for building the app
44
RUN apt-get update && \
5-
apt-get install -y tini && \
5+
apt-get install -y tini curl && \
66
apt-get clean && \
77
rm -rf /var/lib/apt/lists/*
88

@@ -22,6 +22,7 @@ WORKDIR /app
2222

2323
COPY --from=builder /app ./
2424
COPY --from=builder /usr/bin/tini /usr/bin/tini
25+
COPY --from=builder /usr/bin/curl /usr/bin/curl
2526

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

0 commit comments

Comments
 (0)