Skip to content

Commit

Permalink
Add environment variable for configuring storage bucket (#1372)
Browse files Browse the repository at this point in the history
Adds the STORAGE_BUCKET environment variable which is used for
determining which bucket the prepare-chrome-types script loads type data
from.
  • Loading branch information
oliverdunk authored Dec 20, 2024
1 parent 74bca08 commit 600017f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .repo/sample-list-generator/src/prepare-chrome-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ import fs from 'fs/promises';
import { ExtensionApiMap } from './types';
import { ReflectionKind } from 'typedoc';

// Bucket used to store processed types data
const STORAGE_BUCKET = process.env.STORAGE_BUCKET;

// Fetch the latest version of the chrome types from storage
const fetchChromeTypes = async (): Promise<Record<string, any>> => {
if (!STORAGE_BUCKET) {
throw new Error('The STORAGE_BUCKET environment variable must be set.');
}

console.log('Fetching chrome types...');

const response = await fetch(
'https://storage.googleapis.com/download/storage/v1/b/external-dcc-data/o/chrome-types.json?alt=media'
`https://storage.googleapis.com/download/storage/v1/b/${STORAGE_BUCKET}/o/chrome-types.json?alt=media`
);
const chromeTypes = await response.json();
return chromeTypes;
Expand Down

0 comments on commit 600017f

Please sign in to comment.