Skip to content

Commit

Permalink
looser s3 init constraints for local bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
RohinBhargava committed Jan 12, 2025
1 parent fc462cd commit 7d83ab3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/fdr-sdk/src/api-definition/s3Loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { FdrAPI } from "../client";
import { LatestApiDefinition } from "./latest";

export class S3Loader {
private s3Client: S3Client;
private bucketName: string;
private s3Client: S3Client | undefined;
private bucketName: string | undefined;

constructor() {
if (
process.env.AWS_ACCESS_KEY_ID != null &&
Expand All @@ -21,14 +22,16 @@ export class S3Loader {
},
});
this.bucketName = process.env.AWS_S3_BUCKET_NAME;
} else {
throw new Error("Missing S3 API definitions configuration in env vars");
}
}

async loadApiDefinition(
apiDefinitionOrKey: LatestApiDefinition
): Promise<FdrAPI.api.latest.ApiDefinition> {
if (this.s3Client == null) {
throw new Error("S3 client not initialized");
}

let resolvedApi: FdrAPI.api.latest.ApiDefinition;
if (typeof apiDefinitionOrKey === "string") {
const command = new GetObjectCommand({
Expand Down

0 comments on commit 7d83ab3

Please sign in to comment.