All files / src/storage r2-client.ts

16.66% Statements 2/12
100% Branches 0/0
0% Functions 0/1
16.66% Lines 2/12

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 161x       1x                      
import { S3Client } from "@aws-sdk/client-s3";
import type { GpxR2Config } from "../config.js";
 
/** Единая точка создания S3-клиента для Cloudflare R2 (GPX и аватары делят бакет). */
export function createR2Client(r2: GpxR2Config): S3Client {
  return new S3Client({
    region: r2.region,
    endpoint: r2.endpoint,
    credentials: {
      accessKeyId: r2.accessKeyId,
      secretAccessKey: r2.secretAccessKey,
    },
    forcePathStyle: true,
  });
}