Skip to content

Commit

Permalink
docs: Typeds fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed May 4, 2024
1 parent e2dafd3 commit ed11b01
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ServerOptions } from './types/ServerOptions';

export default {
secretKey: 'THISISMYSECURETOKEN',
host: 'http://localhost',
Expand Down Expand Up @@ -95,11 +97,11 @@ export default {
redisPrefix: 'docker',
},
aws_s3: {
region: 'sa-east-1',
region: 'sa-east-1' as any,
access_key_id: null,
secret_key: null,
defaultBucketName: null,
endpoint: null,
forcePathStyle: null,
},
};
} as unknown as ServerOptions;
2 changes: 2 additions & 0 deletions src/types/ServerOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,7 @@ export interface ServerOptions {
access_key_id: string | null;
secret_key: string | null;
defaultBucketName: string | null;
endpoint?: string | null;
forcePathStyle?: boolean | null;
};
}
8 changes: 4 additions & 4 deletions src/util/bucketAlreadyExists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import config from '../config';
export async function bucketAlreadyExists(bucketName: string) {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => {
const s3Client = new S3Client({ region: config.aws_s3.region });

const command = new HeadBucketCommand({ Bucket: bucketName });

try {
if (!config.aws_s3.region) throw new Error('Config your AWS environment');
const s3Client = new S3Client({ region: config.aws_s3.region });

const command = new HeadBucketCommand({ Bucket: bucketName });
await s3Client.send(command);
resolve(true);
} catch (error: any) {
Expand Down

0 comments on commit ed11b01

Please sign in to comment.