Files
upstream-ourboard/backend/src/s3.ts
upstream-mirror d57328655f
Some checks failed
build / test (18.x) (push) Failing after 10s
build / lint (18.x) (push) Failing after 0s
build / docker-image (push) Has been skipped
snapshot of https://github.com/raimohanska/ourboard.git (master, 2026-09-23; blobs > 131072B omitted)
2026-09-23 16:16:17 +05:00

27 lines
531 B
TypeScript

import * as AWS from "aws-sdk"
const s3Config = {
region: "eu-north-1",
apiVersion: "2006-03-01",
signatureVersion: "v4",
}
let s3Instance: AWS.S3 | null = null
export const s3 = () => {
s3Instance = s3Instance || new AWS.S3(s3Config)
return s3Instance
}
export function getSignedPutUrl(Key: string) {
const signedUrlExpireSeconds = 60 * 5
const url = s3().getSignedUrl("putObject", {
Bucket: "r-board-assets",
Key,
Expires: signedUrlExpireSeconds,
})
return url
}