mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-01 08:53:13 +00:00
refactor(server): take the storage roots from DataPathsService
The data-directory change said Nest classes inject DataPathsService, but only AdminService did. StorageRegistryService still read the built-in uploads and backups roots and the scratch dir from module constants frozen at import, and StorageJobsService read the scratch dir the same way. The registry now takes DataPathsService through its constructor (a hand-built one resolves the same layout), and the jobs service asks the registry for its temp dir. The plain helper modules keep calling resolveDataPaths() because they run without a container or are shared with code that does: config.ts, the database path, index.ts, the logger, the backup functions and the plugin trees, which the out-of-process supervisor reads too. The app-config README now lists both sides, and the nest README, server/CLAUDE.md and the provider's own comment say the same.
This commit is contained in:
@@ -5,11 +5,14 @@ import { resolveDataPaths, type DataPaths } from '../../app-config/data-paths';
|
||||
* The data layout for Nest classes: the data directory, uploads, backups,
|
||||
* scratch space, logs, the key files and the database file.
|
||||
*
|
||||
* Code that runs before the container exists (config.ts key resolution, the
|
||||
* database connection, index.ts, the file logger) calls `resolveDataPaths()`
|
||||
* directly; this provider hands the same answer to everything that can take a
|
||||
* constructor argument, so neither side counts `..` hops from its own file.
|
||||
* Resolved once per built app: none of these move while a process runs.
|
||||
* Providers that read a data path take this one (AdminService,
|
||||
* StorageRegistryService). Code that runs before the container exists or is
|
||||
* shared with code outside it (config.ts key resolution, the database
|
||||
* connection, index.ts, the file logger, the backup functions, the plugin
|
||||
* trees) calls `resolveDataPaths()` directly; src/app-config/README.md keeps
|
||||
* the list. Both get the same answer, and neither counts `..` hops from its
|
||||
* own file. Resolved once per built app: none of these move while a process
|
||||
* runs.
|
||||
*/
|
||||
@Injectable()
|
||||
export class DataPathsService implements DataPaths {
|
||||
|
||||
Reference in New Issue
Block a user