Skip to content

Commit bf33078

Browse files
authored
refactor: remove fake google credentials (#202)
1 parent d4eb8b0 commit bf33078

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,5 @@ jobs:
4242
with:
4343
node-version: 20
4444
cache: pnpm
45-
# Setup gcloud application default credentials. While the credentials are not actually
46-
# used because Google api services are stubbed, instantiating any of the Google node
47-
# clients requires the credentials file to exist and be valid.
48-
- uses: "google-github-actions/auth@v2"
49-
with:
50-
credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
51-
- uses: google-github-actions/setup-gcloud@v2
52-
with:
53-
version: ">= 363.0.0"
5445
- run: pnpm install --frozen-lockfile
5546
- run: pnpm run e2e

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"exponential-backoff": "3.1.1",
3636
"extract-zip": "^2.0.1",
3737
"gcp-metadata": "^6.0.0",
38+
"google-auth-library": "^9.15.0",
3839
"nodemailer": "^6.7.8",
3940
"reflect-metadata": "^0.2.2",
4041
"rxjs": "7.8.1",

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/infrastructure/secrets.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { SecretManagerServiceClient } from "@google-cloud/secret-manager";
22
import { Injectable } from "@nestjs/common";
33
import gcpMetadata from "gcp-metadata";
4+
import type { JSONClient } from "google-auth-library/build/src/auth/googleauth";
45

56
@Injectable()
67
export class SecretsClient {
@@ -15,6 +16,14 @@ export class SecretsClient {
1516
fallback: "rest",
1617
protocol: "http",
1718
port: Number(process.env.SECRET_MANAGER_PORT),
19+
// Create a fake auth client to bypass checking for default credentials
20+
authClient: {
21+
getRequestHeaders(
22+
url?: string
23+
): Promise<{ [index: string]: string }> {
24+
return Promise.resolve({});
25+
},
26+
} as JSONClient,
1827
});
1928
} else {
2029
this.googleSecretsClient = new SecretManagerServiceClient();

0 commit comments

Comments
 (0)