mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 11:36:05 +00:00
724c88c201
A mechanical prettier --write over server/src, server/tests, server/scripts and shared/src with the workspaces' .prettierrc; nothing but layout and import order changes, and every file keeps the same set of imports. shared is formatted throughout and its format baseline is empty. The server baseline keeps the 35 files that Prettier would grow past their lint:size limit (they need a split first, which is not a formatting change), and the generated entity files stay as their generator writes them.
40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
import { resolveDataPaths, type DataPaths } from '../../app-config/data-paths';
|
|
import { Injectable } from '@nestjs/common';
|
|
|
|
/**
|
|
* The data layout for Nest classes: the data directory, uploads, backups,
|
|
* scratch space, logs, the key files and the database file.
|
|
*
|
|
* 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 {
|
|
readonly dataDir: string;
|
|
readonly uploadsDir: string;
|
|
readonly backupsDir: string;
|
|
readonly tmpDir: string;
|
|
readonly logsDir: string;
|
|
readonly jwtSecretFile: string;
|
|
readonly encryptionKeyFile: string;
|
|
readonly dbFile: string;
|
|
|
|
constructor() {
|
|
const paths = resolveDataPaths();
|
|
this.dataDir = paths.dataDir;
|
|
this.uploadsDir = paths.uploadsDir;
|
|
this.backupsDir = paths.backupsDir;
|
|
this.tmpDir = paths.tmpDir;
|
|
this.logsDir = paths.logsDir;
|
|
this.jwtSecretFile = paths.jwtSecretFile;
|
|
this.encryptionKeyFile = paths.encryptionKeyFile;
|
|
this.dbFile = paths.dbFile;
|
|
}
|
|
}
|