Files
DenReg/registry/src/s3.ts
Fabian Stamm 252bf4aac3
All checks were successful
continuous-integration/drone/push Build is passing
Remove logging output
2020-10-14 21:47:09 +02:00

31 lines
709 B
TypeScript

import { S3 } from "./deps.ts";
import config from "./config.ts";
if (!config.s3) {
throw new Error("Config is missing [s3] section!");
}
if (!config.s3.endpoint) {
throw new Error("Config is missing s3.endpoint!");
}
if (!config.s3.accessKey) {
throw new Error("Config is missing s3.accessKey!");
}
if (!config.s3.secretKey) {
throw new Error("Config is missing s3.secretKey!");
}
const s3config: S3.S3BucketConfig = {
bucket: config.s3.bucket || "deno-registry",
endpointURL: config.s3.endpoint,
accessKeyID: config.s3.accessKey,
secretKey: config.s3.secretKey,
region: config?.s3?.region || "us-east-1",
};
const bucket = new S3.S3Bucket(s3config);
export default bucket;