Skip to content
This repository has been archived by the owner on Jan 28, 2024. It is now read-only.

Commit

Permalink
refactor(config): move pino-pretty config out of script
Browse files Browse the repository at this point in the history
  • Loading branch information
Frazer Smith committed Mar 15, 2021
1 parent e3e360f commit 7d5c119
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"lint:prettier": "prettier . --write --ignore-unknown",
"lint:prettier:ci": "prettier . --check --ignore-unknown",
"start": "node .",
"start:dev": "nodemon | pino-pretty --colorize",
"start:dev": "nodemon",
"test": "npm run lint && npm run jest"
},
"commitlint": {
Expand Down
9 changes: 9 additions & 0 deletions src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ async function getConfig() {
});
}

/**
* Pretty output to stdout out if not in production.
* Replaces using `pino-pretty` in scripts, as it does not play
* well with Nodemon
*/
if (env.NODE_ENV !== "PRODUCTION" && !env.LOG_ROTATION_FILENAME) {
config.fastifyInit.logger.prettyPrint = true;
}

if (env.AUTH_BEARER_TOKEN_ARRAY) {
const keys = new Set();
JSON.parse(env.AUTH_BEARER_TOKEN_ARRAY).forEach((element) => {
Expand Down

0 comments on commit 7d5c119

Please sign in to comment.