Skip to content

Commit

Permalink
Fix diagnose log_dir_path value
Browse files Browse the repository at this point in the history
Use the `logFilePath`'s value as a base and get the parent directory
path to check.

This way the `log_dir_path` and `appsignal.log` paths don't point at
different directories. This could have happen because the `logFilePath`
getter (used by `appsignal.log`) does a permission check and falls back
on the system `/tmp` dir if the user configured path can't be written
to.
  • Loading branch information
tombruijn committed Nov 23, 2021
1 parent a5a1724 commit 2358c9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/nodejs/.changesets/fix-diagnose-log_dir_path-path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
bump: "patch"
---

Fix the diagnose's `log_dir_path` path check. It now always checks the actual log file's parent directory, rather than the configured path. These two values may differ as the package does a permission check to see if the `logPath` is writable or not.
2 changes: 1 addition & 1 deletion packages/nodejs/src/diagnose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class DiagnoseTool {
path: process.cwd()
},
log_dir_path: {
path: this.#config.data.logPath!.replace("/appsignal.log", "")
path: path.dirname(logFilePath)
},
"appsignal.log": {
path: logFilePath,
Expand Down

0 comments on commit 2358c9f

Please sign in to comment.