Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 1x 1x 39x 39x 39x 39x 39x 39x | import type { AppConfig } from "../config.js";
import { createR2Client } from "./r2-client.js";
import type { GpxContentStore } from "./gpx-content-store.js";
import { LocalDirectoryGpxStore } from "./local-directory-gpx-store.js";
import { R2GpxStore } from "./r2-gpx-store.js";
/** Фабрика хранилища GPX: локальная папка или S3-совместимый бакет (Cloudflare R2). */
export function createGpxContentStore(config: AppConfig): GpxContentStore {
switch (config.gpxStorageDriver) {
case "local":
return new LocalDirectoryGpxStore(config.gpxLocalRoot);
case "r2": {
const r2 = config.gpxR2;
if (!r2) {
throw new Error("GPX_STORAGE_DRIVER=r2 requires R2 configuration");
}
return new R2GpxStore(createR2Client(r2), r2.bucket, r2.keyPrefix, r2.trashBucket);
}
}
}
|