22 lines
553 B
TypeScript
22 lines
553 B
TypeScript
import { CONFIG } from '../initializers/constants'
|
|
import { doRequest } from '../helpers/requests'
|
|
|
|
async function listIndexInstancesHost () {
|
|
const uri = CONFIG.INSTANCES_INDEX.URL + '/api/v1/instances/hosts'
|
|
|
|
const qs = { count: 5000 }
|
|
|
|
const { body } = await doRequest({ uri, qs, json: true })
|
|
|
|
return body.data.map(o => o.host as string)
|
|
}
|
|
|
|
function getRemovedHosts (dbHosts: string[], indexHosts: string[]) {
|
|
return dbHosts.filter(dbHost => indexHosts.includes(dbHost) === false)
|
|
}
|
|
|
|
export {
|
|
getRemovedHosts,
|
|
listIndexInstancesHost
|
|
}
|