Skip to content

Commit

Permalink
update extractFilesFromGCS() in BaseDriver to receive credentials ins…
Browse files Browse the repository at this point in the history
…tead of Storage instance
  • Loading branch information
KSDaemon committed Sep 25, 2024
1 parent 9fa541f commit 2ec068f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/cubejs-base-driver/src/BaseDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ export type AzureStorageClientConfig = {
sasToken?: string,
};

export type GoogleStorageClientConfig = {
credentials: any,
};

const sortByKeys = (unordered: any) => {
const ordered: any = {};

Expand Down Expand Up @@ -690,10 +694,14 @@ export abstract class BaseDriver implements DriverInterface {
* Returns an array of signed GCS URLs of the unloaded csv files.
*/
protected async extractFilesFromGCS(
storage: Storage,
gcsConfig: GoogleStorageClientConfig,
bucketName: string,
tableName: string
): Promise<string[]> {
const storage = new Storage({
credentials: gcsConfig.credentials,
projectId: gcsConfig.credentials.project_id
});
const bucket = storage.bucket(bucketName);
const [files] = await bucket.getFiles({ prefix: `${tableName}/` });
if (files.length) {
Expand Down

0 comments on commit 2ec068f

Please sign in to comment.