-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Re-enable the dev dashboard 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. This adds the CI private CA key. 2. Login requires that the Keycloak be configured with the address of the dashboard code, which in this mode is http://localhost:3000. This adds that redirect to the Keycloak configuration
- Loading branch information
Showing
2 changed files
with
29 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
const express = require('express'); | ||
const axios = require('axios'); | ||
require('dotenv').config() | ||
const express = require("express"); | ||
const axios = require("axios"); | ||
const https = require("https"); | ||
const fs = require("fs"); | ||
require("dotenv").config(); | ||
|
||
const app = express(); | ||
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" }, | ||
httpsAgent: new https.Agent({ | ||
ca: fs.readFileSync( | ||
"../server/pbenchinacan/etc/pki/tls/certs/pbench_CA.crt" | ||
) | ||
}), | ||
}) | ||
.then((endpoints) => { | ||
res.setHeader("Content-Type", "application/json"); | ||
res.send(endpoints.data); | ||
}) | ||
.catch((err) => { | ||
console.log("Error: ", err.message); | ||
}); | ||
}); | ||
|
||
const app = express() | ||
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' } }) | ||
.then(endpoints => { | ||
res.setHeader('Content-Type', 'application/json'); | ||
res.send(endpoints.data); | ||
}) | ||
.catch(err => { | ||
console.log('Error: ', err.message); | ||
}) | ||
}) | ||
|
||
app.listen(3001, () => console.log('Mirror server running on localhost:3001')); | ||
app.listen(3001, () => console.log("Mirror server running on localhost:3001")); |
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