Skip to content

Commit 3d56fae

Browse files
Switch HIP-RA over to new endpoint
1 parent 7c406d1 commit 3d56fae

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

geophires/geophires-ui.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,6 @@ function renderRevenueAndCashflowProfile(resultsData) {
207207

208208
}
209209

210-
let _UI_KEY = 'RONSrTE7Es7iIJ2D9S2Xn3e49vCXV1Sl7FFi3kaU'
211-
212210
function submitForm(oFormElement) {
213211
let parsed_params = JSON.parse(oFormElement.querySelector('textarea[name="geophires_input_parameters"]').value)
214212

@@ -366,7 +364,7 @@ $(document).ready(function () {
366364
if (location.hostname.indexOf('localhost') !== -1) {
367365
const path = 'get-geophires-result'
368366
const url = `https://dev.gtp.scientificweb.services/${path}`
369-
_UI_KEY = 'dQz4mnNwyF68ho47m0biA2Q7mEt5Ub1Q2SV9ezhc'
367+
_UI_KEY = _DEV_UI_KEY
370368
$('form.apiActionForm').attr('action', url)
371369

372370
setVisible($('#json-input-tab'), true)

geophires/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<link href="geophires-ui.css" rel="stylesheet" type="text/css"/>
2525

2626
<script src="util.js"></script>
27+
<script src="../lib/sws.js"></script>
2728
<script src="geophires-ui.js"></script>
2829
<script src="geophires.js"></script>
2930

hip-ra/hip-ra.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,19 @@ Density Of Water, -1`),
5656
}
5757

5858
this.hipRaLoading = true
59-
let stageName = 'prod'
59+
let urlSubdomainForStage = 'api'
6060
if (getLocationHost().indexOf('localhost') !== -1) {
61-
stageName = 'dev'
61+
urlSubdomainForStage = 'dev'
62+
_UI_KEY = _DEV_UI_KEY
6263
}
6364

6465
fetch(
65-
`https://${stageName}.gt1.scientificweb.services/get-hip-ra-result`,
66+
`https://${urlSubdomainForStage}.gtp.scientificweb.services/get-hip-ra-result`,
6667
{
6768
method: 'POST',
69+
headers: {
70+
'x-api-key': _UI_KEY
71+
},
6872
body: JSON.stringify({
6973
hip_ra_input_parameters: params
7074
})

hip-ra/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ <h2><a id="about">About</a></h2>
120120
</div>
121121
</div>
122122

123+
<script src="../lib/sws.js"></script>
123124
<script type="module" src="hip-ra.js"></script>
124125

125126
</body>

lib/sws.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const _DEFAULT_UI_KEY = 'RONSrTE7Es7iIJ2D9S2Xn3e49vCXV1Sl7FFi3kaU'
2+
const _DEV_UI_KEY = 'dQz4mnNwyF68ho47m0biA2Q7mEt5Ub1Q2SV9ezhc'
3+
let _UI_KEY = _DEFAULT_UI_KEY

0 commit comments

Comments
 (0)