TechDocs/GCS: Remove projectId since it is not needed

I initially thought the GCS Nodejs client would make use of it, since it asked for it in the contructor. However, we may not need them at all. Buckets are gloablly unique anyway.
This commit is contained in:
Himanshu Mishra
2021-01-09 16:29:42 +01:00
parent 1ef5d0f13c
commit e7954559ab
5 changed files with 8 additions and 23 deletions
@@ -14,7 +14,6 @@
* limitations under the License.
*/
type storageOptions = {
projectId?: string;
keyFilename?: string;
};
@@ -39,11 +38,9 @@ class Bucket {
}
export class Storage {
private readonly projectId;
private readonly keyFilename;
constructor(options: storageOptions) {
this.projectId = options.projectId;
this.keyFilename = options.keyFilename;
}
@@ -37,7 +37,7 @@ jest.spyOn(logger, 'info').mockReturnValue(logger);
let publisher: PublisherBase;
beforeEach(() => {
beforeEach(async () => {
const mockConfig = new ConfigReader({
techdocs: {
requestUrl: 'http://localhost:7000',
@@ -45,14 +45,13 @@ beforeEach(() => {
type: 'googleGcs',
googleGcs: {
credentials: '{}',
projectId: 'gcp-project-id',
bucketName: 'bucketName',
},
},
},
});
publisher = GoogleGCSPublish.fromConfig(mockConfig, logger);
publisher = await GoogleGCSPublish.fromConfig(mockConfig, logger);
});
describe('GoogleGCSPublish', () => {
@@ -56,15 +56,11 @@ export class GoogleGCSPublish implements PublisherBase {
);
}
}
const projectId = config.getOptionalString(
'techdocs.publisher.googleGcs.projectId',
);
const storageClient = new Storage({
...(credentials && {
credentials: credentialsJson,
}),
...(projectId && { projectId }),
});
// Check if the defined bucket exists. Being able to connect means the configuration is good
@@ -69,7 +69,6 @@ describe('Publisher', () => {
type: 'googleGcs',
googleGcs: {
credentials: '{}',
projectId: 'gcp-project-id',
bucketName: 'bucketName',
},
},