feat: add port config opt for s3

This commit is contained in:
diced 2022-10-23 12:33:04 -07:00
parent f58d33af9e
commit a8475602c7
No known key found for this signature in database
GPG key ID: 370BD1BA142842D1
4 changed files with 4 additions and 0 deletions

View file

@ -25,6 +25,7 @@ export interface ConfigS3Datasource {
access_key_id: string;
secret_access_key: string;
endpoint?: string;
port?: number;
bucket: string;
force_s3_path: boolean;
use_ssl: boolean;

View file

@ -58,6 +58,7 @@ export default function readConfig() {
map('DATASOURCE_S3_ACCESS_KEY_ID', 'string', 'datasource.s3.access_key_id'),
map('DATASOURCE_S3_SECRET_ACCESS_KEY', 'string', 'datasource.s3.secret_access_key'),
map('DATASOURCE_S3_ENDPOINT', 'string', 'datasource.s3.endpoint'),
map('DATASOURCE_S3_PORT', 'number', 'datasource.s3.port'),
map('DATASOURCE_S3_BUCKET', 'string', 'datasource.s3.bucket'),
map('DATASOURCE_S3_FORCE_S3_PATH', 'boolean', 'datasource.s3.force_s3_path'),
map('DATASOURCE_S3_REGION', 'string', 'datasource.s3.region'),

View file

@ -45,6 +45,7 @@ const validator = s.object({
access_key_id: s.string,
secret_access_key: s.string,
endpoint: s.string,
port: s.number.optional.default(undefined),
bucket: s.string,
force_s3_path: s.boolean.default(false),
region: s.string.default('us-east-1'),

View file

@ -14,6 +14,7 @@ export class S3 extends Datasource {
accessKey: config.access_key_id,
secretKey: config.secret_access_key,
pathStyle: config.force_s3_path,
port: config.port ?? undefined,
useSSL: config.use_ssl,
region: config.region,
});