Skip to content

Commit

Permalink
feat(cloud-tasks-utils): init client on Cloud Functions and Cloud Run…
Browse files Browse the repository at this point in the history
… service
  • Loading branch information
jackdbd committed Sep 13, 2022
1 parent 81f049d commit d1c5161
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/cloud-tasks-utils/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export const cloudTasks = (options: Options = DEFAULT_OPTIONS) => {
details.push(`process.env.CLOUD_RUN_JOB not set`)
}

if (process.env.FUNCTION_SIGNATURE_TYPE) {
return new CloudTasksClient()
} else {
details.push(`process.env.FUNCTION_SIGNATURE_TYPE not set`)
}

if (process.env.GOOGLE_APPLICATION_CREDENTIALS) {
return new CloudTasksClient({
keyFilename: process.env.GOOGLE_APPLICATION_CREDENTIALS
Expand All @@ -45,6 +51,12 @@ export const cloudTasks = (options: Options = DEFAULT_OPTIONS) => {
details.push(`process.env.GOOGLE_APPLICATION_CREDENTIALS not set`)
}

if (process.env.K_SERVICE) {
return new CloudTasksClient()
} else {
details.push(`process.env.K_SERVICE not set`)
}

const env_key =
options && options.env_key_json_string
? options.env_key_json_string
Expand Down

0 comments on commit d1c5161

Please sign in to comment.