Skip to content

Commit

Permalink
Add ability to set a sennet token
Browse files Browse the repository at this point in the history
  • Loading branch information
bherr2 committed Nov 29, 2023
1 parent df0aa07 commit 4d26478
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions projects/ccf-api/src/lib/middleware/database-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ function selectToken(token: string | undefined, req: Request): string {

function createDatabase(token: string, options: CCFDatabaseOptions): Promise<CCFDatabaseInstance> {
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const hubmapToken = token || options.hubmapToken || undefined;
const xConsortiaToken = token || options.hubmapToken || undefined;

return createCCFDatabaseWorker({
...options,
hubmapDataUrl: '', // Do not use deprecated internal hubmap data loading
dataSources: options.dataSources.map(s =>
hubmapToken && typeof s === 'string' && s.endsWith('hubmap/rui_locations.jsonld') ? `${s}?token=${hubmapToken}` : s
)
xConsortiaToken && typeof s === 'string' && (
(!xConsortiaToken.startsWith('SNT-') && s.endsWith('hubmap/rui_locations.jsonld'))

Check failure on line 51 in projects/ccf-api/src/lib/middleware/database-loader.ts

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Expected indentation of 8 spaces but found 11

Check failure on line 51 in projects/ccf-api/src/lib/middleware/database-loader.ts

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Expected indentation of 8 spaces but found 11
|| (xConsortiaToken.startsWith('SNT-') && s.endsWith('sennet/rui_locations.jsonld'))
) ? `${s}?token=${xConsortiaToken}` : s)
});
}

Expand Down

0 comments on commit 4d26478

Please sign in to comment.