Skip to content

Commit 1279347

Browse files
authored
Merge pull request #57 from NLnetLabs/revert-46
Remove the API_HOST runtime configuration again
2 parents c391403 + 4280156 commit 1279347

File tree

4 files changed

+8
-59
lines changed

4 files changed

+8
-59
lines changed

Diff for: README.md

-16
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,6 @@ The API hosts to use can be specified at runtime or at build time. By default
7979
the current host is used for the Routinator API endpoints and https://rest.bgp-api.net
8080
for the Roto API.
8181

82-
### Runtime
83-
84-
The `index.html` file contains the following fragment:
85-
86-
```javascript
87-
window.ROTO_API_HOST = 'ROTO_API_HOST_PLACEHOLDER';
88-
window.ROUTINATOR_API_HOST = 'ROUTINATOR_API_HOST_PLACEHOLDER';
89-
```
90-
91-
The respective endpoints can be configured by replacing the string
92-
`ROTO_API_HOST_PLACEHOLDER` and/or the string `ROUTINATOR_API_HOST_PLACEHOLDER`
93-
before serving the content of `index.html`. If these are not configured at runtime
94-
the build time variables or the defaults will be used.
95-
96-
### Build time
97-
9882
By specifying `ROTO_API_HOST` and/or `ROUTINATOR_API_HOST` as environment variables
9983
these can be configured at build time. For example:
10084

Diff for: index.html

-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
<meta name="description" content="User interface for Routinator. Perform a Prefix Check, view detailed statistics from the last validation run Routinator has performed and HTTP and RTR connection metrics." />
77
<title>Routinator</title>
88
<link rel="icon" href="/src/img/favicon.ico">
9-
<script>
10-
window.ROTO_API_HOST = 'ROTO_API_HOST_PLACEHOLDER';
11-
window.ROUTINATOR_API_HOST = 'ROUTINATOR_API_HOST_PLACEHOLDER';
12-
</script>
139
</head>
1410
<body>
1511
<div id="root"></div>

Diff for: src/core/contants.ts

+8-33
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,8 @@
1-
function getRotoEndpoint() {
2-
if (
3-
typeof window !== 'undefined' &&
4-
window.ROTO_API_HOST !== 'ROTO_API_HOST_PLACEHOLDER'
5-
) {
6-
return window.ROTO_API_HOST;
7-
}
8-
9-
if (typeof ROTO_API_HOST !== 'undefined') {
10-
return ROTO_API_HOST;
11-
}
12-
13-
return 'https://rest.bgp-api.net';
14-
}
15-
16-
// public endpoint: https://routinator.do.nlnetlabs.nl
17-
function getApiEndpoint() {
18-
if (
19-
typeof window !== 'undefined' &&
20-
window.ROUTINATOR_API_HOST !== 'ROUTINATOR_API_HOST_PLACEHOLDER'
21-
) {
22-
return window.ROUTINATOR_API_HOST;
23-
}
24-
25-
if (typeof ROUTINATOR_API_HOST !== 'undefined') {
26-
return ROUTINATOR_API_HOST;
27-
}
28-
29-
return '';
30-
}
31-
32-
export const ROTO_ENDPOINT = getRotoEndpoint();
33-
export const API_ENDPOINT = getApiEndpoint();
1+
export const ROTO_ENDPOINT =
2+
typeof ROTO_API_HOST === 'undefined'
3+
? 'https://rest.bgp-api.net'
4+
: ROTO_API_HOST;
5+
export const API_ENDPOINT =
6+
typeof ROUTINATOR_API_HOST === 'undefined'
7+
? 'https://routinator.do.nlnetlabs.nl'
8+
: ROUTINATOR_API_HOST;

Diff for: src/types.ts

-6
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,3 @@ export interface RouteIdent {
207207
max_length: string;
208208
}
209209

210-
declare global {
211-
interface Window {
212-
ROUTINATOR_API_HOST: string;
213-
ROTO_API_HOST: string;
214-
}
215-
}

0 commit comments

Comments
 (0)