Skip to content

Commit

Permalink
chore: working secrets being setup properly
Browse files Browse the repository at this point in the history
  • Loading branch information
peeter-tomberg committed Aug 13, 2023
1 parent 086c21d commit 6df828c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/graphql-gateway/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,23 @@ import { HealthModule } from '@package/nestjs-health';
import { GoogleAuth } from 'google-auth-library';
import { FetcherRequestInit } from '@apollo/utils.fetcher';

const auth = new GoogleAuth();

const fetcher = async (url: string, init: FetcherRequestInit | undefined): Promise<any> => {

Check failure on line 12 in apps/graphql-gateway/src/app.module.ts

View workflow job for this annotation

GitHub Actions / verify

Unexpected any. Specify a different type
const auth = new GoogleAuth({
scopes: 'https://www.googleapis.com/auth/cloud-platform',
});
const headers = await auth.getRequestHeaders(url);
const credentialBody = await auth.getCredentials();
const { credential } = await auth.getApplicationDefault();

const customInit = {
...init,
headers: {
...init?.headers,
...headers,
'X-Serverless-Authorization': `Bearer ${credential.credentials.id_token}`,
},
};
console.log('credentialBody', credentialBody);
console.log('credential, projectId', credential.credentials.id_token);
console.log('headers', headers);
console.log('customInit', customInit);
return await fetch(url, customInit);
Expand Down

0 comments on commit 6df828c

Please sign in to comment.