mirror of
https://github.com/linkwarden/linkwarden.git
synced 2026-06-28 14:55:49 +00:00
20 lines
559 B
TypeScript
20 lines
559 B
TypeScript
import { S3 } from "@aws-sdk/client-s3";
|
|
|
|
const s3Client: S3 | undefined =
|
|
process.env.SPACES_ENDPOINT &&
|
|
process.env.SPACES_REGION &&
|
|
process.env.SPACES_KEY &&
|
|
process.env.SPACES_SECRET
|
|
? new S3({
|
|
forcePathStyle: process.env.SPACES_FORCE_PATH_STYLE === "true",
|
|
endpoint: process.env.SPACES_ENDPOINT,
|
|
region: process.env.SPACES_REGION,
|
|
credentials: {
|
|
accessKeyId: process.env.SPACES_KEY,
|
|
secretAccessKey: process.env.SPACES_SECRET,
|
|
},
|
|
})
|
|
: undefined;
|
|
|
|
export default s3Client;
|