Add .json extension to config file.
A tiny bit of refactoring.
This commit is contained in:
parent
75e81e7956
commit
1afe267866
26
app.js
26
app.js
|
@ -74,16 +74,25 @@ router.get('/topics/:cluster', async (req, res, _next) => {
|
|||
}
|
||||
})
|
||||
|
||||
const buildSocketMessageSender = ({ type, socket }) => message => {
|
||||
socket.send(JSON.stringify({
|
||||
type,
|
||||
message
|
||||
}))
|
||||
}
|
||||
|
||||
const deepCopy = object => JSON.parse(JSON.stringify(object))
|
||||
|
||||
const passwordPlaceholder = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX'
|
||||
|
||||
const getClusterData = () =>
|
||||
Object.fromEntries(
|
||||
Object.entries(clusters).map(([key, value]) => {
|
||||
value = JSON.parse(JSON.stringify(value))
|
||||
if (value.config.sasl?.password) {
|
||||
value.config.sasl.password = passwordPlaceholder
|
||||
Object.entries(clusters).map(([key, cluster]) => {
|
||||
cluster = deepCopy(cluster)
|
||||
if (cluster.config.sasl?.password) {
|
||||
cluster.config.sasl.password = passwordPlaceholder
|
||||
}
|
||||
return [key, value.config]
|
||||
return [key, cluster.config]
|
||||
}))
|
||||
|
||||
router.get('/clusters', async (req, res, _next) => {
|
||||
|
@ -132,13 +141,6 @@ router.put('/clusters', async (req, res, _next) => {
|
|||
|
||||
app.use(router)
|
||||
|
||||
const buildSocketMessageSender = ({ type, socket }) => message => {
|
||||
socket.send(JSON.stringify({
|
||||
type,
|
||||
message
|
||||
}))
|
||||
}
|
||||
|
||||
const realTimeSearch = async ({ kafka, socket, topic }) =>
|
||||
query.realTimeMessageSearch({
|
||||
kafka,
|
||||
|
|
Loading…
Reference in New Issue