enabling minio support for S3 connector

This commit is contained in:
Martin McKeaveney 2021-12-31 16:15:49 +00:00
parent bc6c50482c
commit e87a348fb8
1 changed files with 10 additions and 11 deletions

View File

@ -8,6 +8,8 @@ module S3Module {
region: string region: string
accessKeyId: string accessKeyId: string
secretAccessKey: string secretAccessKey: string
s3ForcePathStyle: boolean
endpoint?: string
} }
const SCHEMA: Integration = { const SCHEMA: Integration = {
@ -18,7 +20,7 @@ module S3Module {
datasource: { datasource: {
region: { region: {
type: "string", type: "string",
required: true, required: false,
default: "us-east-1", default: "us-east-1",
}, },
accessKeyId: { accessKeyId: {
@ -33,13 +35,10 @@ module S3Module {
type: "string", type: "string",
required: false, required: false,
}, },
s3ForcePathStyle: {
type: "boolean",
required: false,
},
signatureVersion: { signatureVersion: {
type: "string", type: "string",
required: false, required: false,
default: "v4"
}, },
}, },
query: { query: {
@ -58,16 +57,16 @@ module S3Module {
class S3Integration implements IntegrationBase { class S3Integration implements IntegrationBase {
private readonly config: S3Config private readonly config: S3Config
private client: any private client: any
private connectionPromise: Promise<any>
constructor(config: S3Config) { constructor(config: S3Config) {
this.config = config this.config = config
this.connectionPromise = this.connect() if (this.config.endpoint) {
this.client = new AWS.S3() this.config.s3ForcePathStyle = true
} else {
delete this.config.endpoint
} }
async connect() { this.client = new AWS.S3(this.config)
AWS.config.update(this.config)
} }
async read(query: { bucket: string }) { async read(query: { bucket: string }) {