Skip to content

Commit 10a0438

Browse files
committed
fix: app now stops on Ctrl+C when running in Docker
Replace shell pipeline (| pino-pretty) with fastify-cli's built-in options loading (-o). The logger transport with pino-pretty (singleLine) is configured via the exported 'options' constant in server/plugin.js. Using 'exec' makes fastify PID 1, so Docker signals (SIGINT/SIGTERM) are delivered directly to the Node.js process instead of being lost by the shell. Closes #11
1 parent 4b81b1a commit 10a0438

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

bin/start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ set -e
44

55
export NODE_OPTIONS="--import ./instrument.js"
66

7-
fastify start server/plugin.js -a 0.0.0.0 -l info | pino-pretty -S
7+
exec fastify start server/plugin.js -a 0.0.0.0 -l info -o

server/plugin.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,13 @@ export default (app, _options) => {
5555
return app;
5656
};
5757

58-
// export const options = {
59-
// logger: {
60-
// options: {
61-
// singleLine: true,
62-
// },
63-
// },
64-
// };
58+
export const options = {
59+
logger: {
60+
transport: {
61+
target: 'pino-pretty',
62+
options: {
63+
singleLine: true,
64+
},
65+
},
66+
},
67+
};

0 commit comments

Comments
 (0)