-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(lapis2-docs): configure LAPIS URL via environment variable
- Loading branch information
1 parent
f98a835
commit 2ede4aa
Showing
7 changed files
with
31 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
--- | ||
interface Props { | ||
url: string; | ||
} | ||
const { url } = Astro.props; | ||
const test = 'df'; | ||
import { getLapisUrl } from '../lapisUrl'; | ||
const openApiUrl = getLapisUrl() + '/api-docs'; | ||
--- | ||
|
||
YAML definition: <a href={openApiUrl}>{openApiUrl}</a> | ||
|
||
<head> | ||
<!-- TODO Don't fetch from external source! --> | ||
<link rel='stylesheet' href='https://unpkg.com/[email protected]/swagger-ui.css' /> | ||
</head> | ||
|
||
<div class='not-content'> | ||
<swagger-ui-container data-url={url}></swagger-ui-container> | ||
<swagger-ui-container data-url={openApiUrl}></swagger-ui-container> | ||
</div> | ||
|
||
<script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
let lapisUrl: string | null = null; | ||
|
||
export function getLapisUrl(): string { | ||
if (lapisUrl === null) { | ||
if (import.meta.env.LAPIS_URL === undefined) { | ||
throw new Error('LAPIS_URL environment variable is not set'); | ||
} | ||
lapisUrl = (import.meta.env.LAPIS_URL as string).replace(/\/$/, ''); | ||
} | ||
return lapisUrl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters