mirror of
https://github.com/zadam/trilium.git
synced 2026-05-06 22:17:01 +02:00
chore(ocr): support overriding cache dir
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, beforeEach, vi } from "vitest";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import type { getTriliumDataDir as getTriliumDataDirType, getDataDirs as getDataDirsType, getPlatformAppDataDir as getPlatformAppDataDirType } from "./data_dir.js";
|
||||
import type { getDataDirs as getDataDirsType, getPlatformAppDataDir as getPlatformAppDataDirType,getTriliumDataDir as getTriliumDataDirType } from "./data_dir.js";
|
||||
|
||||
describe("data_dir.ts unit tests", async () => {
|
||||
let getTriliumDataDir: typeof getTriliumDataDirType;
|
||||
@@ -277,7 +277,7 @@ describe("data_dir.ts unit tests", async () => {
|
||||
});
|
||||
|
||||
describe("#getDataDirs()", () => {
|
||||
const envKeys: Omit<keyof ReturnType<typeof getDataDirs>, "TRILIUM_DATA_DIR">[] = [ "DOCUMENT_PATH", "BACKUP_DIR", "LOG_DIR", "ANONYMIZED_DB_DIR", "CONFIG_INI_PATH", "TMP_DIR" ];
|
||||
const envKeys: Omit<keyof ReturnType<typeof getDataDirs>, "TRILIUM_DATA_DIR">[] = [ "DOCUMENT_PATH", "BACKUP_DIR", "LOG_DIR", "ANONYMIZED_DB_DIR", "CONFIG_INI_PATH", "TMP_DIR", "OCR_CACHE_DIR" ];
|
||||
|
||||
const setMockedEnv = (prefix: string | null) => {
|
||||
envKeys.forEach((key) => {
|
||||
|
||||
@@ -48,7 +48,7 @@ export function getDataDirs(TRILIUM_DATA_DIR: string) {
|
||||
TMP_DIR: process.env.TRILIUM_TMP_DIR || pathJoin(TRILIUM_DATA_DIR, "tmp"),
|
||||
ANONYMIZED_DB_DIR: process.env.TRILIUM_ANONYMIZED_DB_DIR || pathJoin(TRILIUM_DATA_DIR, "anonymized-db"),
|
||||
CONFIG_INI_PATH: process.env.TRILIUM_CONFIG_INI_PATH || pathJoin(TRILIUM_DATA_DIR, "config.ini"),
|
||||
OCR_CACHE_DIR: pathJoin(TRILIUM_DATA_DIR, "ocr-cache")
|
||||
OCR_CACHE_DIR: process.env.TRILIUM_OCR_CACHE_DIR || pathJoin(TRILIUM_DATA_DIR, "ocr-cache")
|
||||
} as const;
|
||||
|
||||
createDirIfNotExisting(dataDirs.TMP_DIR);
|
||||
|
||||
Reference in New Issue
Block a user