Skip to content

Commit

Permalink
refactor(publisher-gcs): extracted ternary operator
Browse files Browse the repository at this point in the history
  • Loading branch information
mahnunchik committed Jun 10, 2020
1 parent 072085e commit ba0a77f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/publisher/gcs/src/PublisherGCS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ export default class PublisherGCS extends PublisherBase<PublisherGCSConfig> {
const clientEmail = config.clientEmail || process.env.GOOGLE_CLOUD_CLIENT_EMAIL;
const privateKey = config.privateKey || process.env.GOOGLE_CLOUD_PRIVATE_KEY;

const storage = new Storage({
keyFilename: config.projectId || process.env.GOOGLE_APPLICATION_CREDENTIALS,
credentials: (clientEmail && privateKey) ? {
let credentials;
if (clientEmail && privateKey) {
credentials = {
client_email: clientEmail,
private_key: privateKey,
} : undefined,
};
}

const storage = new Storage({
keyFilename: config.projectId || process.env.GOOGLE_APPLICATION_CREDENTIALS,
credentials,
projectId: config.projectId || process.env.GOOGLE_CLOUD_PROJECT,
});

Expand Down

0 comments on commit ba0a77f

Please sign in to comment.