Skip to content

Fix path resolution in settings.json and static.ts after server refactoring #1014

@coderabbitai

Description

@coderabbitai

Problem

After the server refactoring in PR #899, the path resolution in both settings.json and src/routes/static.ts needs adjustment due to the new directory structure.

Issues Identified

1. settings.json paths need one more level up

The current paths in components/log-viewer-webui/server/settings.json are:

  • "ClientDir": "../../client/dist"
  • "LogViewerDir": "../../yscope-log-viewer/dist"
  • "StreamFilesDir": "../../../../build/clp-package/var/data/streams"

These need to be adjusted to add one more ../ level:

  • "ClientDir": "../../../client/dist"
  • "LogViewerDir": "../../../yscope-log-viewer/dist"
  • "StreamFilesDir": "../../../../../build/clp-package/var/data/streams"

2. rootDirname in src/routes/static.ts needs adjustment

The rootDirname variable should be changed to:

rootDirname = path.resolve(dirname, "../../../..")

Context

  • The current directory should be assumed to be where settings.json is located
  • The server structure has changed due to the Fastify refactoring
  • This affects static file serving and path resolution

Related

Reported by: @junhaoliao

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions