Skip to content

Commit

Permalink
Simple first step to re-enable the dev dashboard
Browse files Browse the repository at this point in the history
PBENCH-1203

The shift to HTTPS and Keycloak has broken our dashboard local dev mode hack
in two ways:

1. The `axios.get` call in the express mirror server needs to either load
certificates or disable validation. (The latter seems easier since it's only
for local dev mode.)
2. Login requires that the Keycloak be configured with the address of the
dashboard code, which in this mode is `http://localhost:3000`. We need to
figure out how to get Keycloak and React on the same page here

I'm less sure how to accomplish the second, though.

1. We could hardcode the additional address (in three places) in setting up
the Keycloak pbench client (valid redirect, valid post logout, web origins)
unconditionally... ugly, and we don't want it for staging
2. We could add another option to the functional test deployment to add them
only for a `runlocal`
3. We could just document how to do it manually ...

   NOTE: log in to `https://localhost:8090` with `admin`/`admin`, select the
   `pbench-server` realm, `Clients` in the sidebar, select the `pbench-client`,
   then `+ Add valid redirect URIs` and `+Add valid post logout redirect URIs`
   and on each add `http://localhost:3000/*`, then `+Add web origins` and add
   `http://localhost:3000`, then click `Save` at the bottom.)

I don't really like any of these options much, so feedback is welcome.
  • Loading branch information
dbutenhof committed Jul 3, 2023
1 parent 3b8bf2f commit 1c65320
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dashboard/server/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const express = require('express');
const axios = require('axios');
const https = require('https')
require('dotenv').config()


Expand All @@ -8,7 +9,12 @@ app.get('/api/v1/endpoints', (_req, res) => {
console.log('Mirror engaged: ', process.env.PBENCH_SERVER)
axios.get(
`${process.env.PBENCH_SERVER}/api/v1/endpoints`,
{ headers: { 'Accept': 'application/json' } })
{
headers: { 'Accept': 'application/json' },
httpsAgent: new https.Agent({
rejectUnauthorized: false
})
})
.then(endpoints => {
res.setHeader('Content-Type', 'application/json');
res.send(endpoints.data);
Expand Down

0 comments on commit 1c65320

Please sign in to comment.