Merge branch 'master' into meilisearch
This commit is contained in:
commit
c9f901d6a3
|
@ -15,13 +15,17 @@ export async function listIndexInstancesHost (): Promise<string[]> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getMajorInstanceVersion (host: string): Promise<number> {
|
export async function getMajorInstanceVersion (host: string): Promise<number> {
|
||||||
const { body } = await doRequest<any>({ uri: `https://${host}/api/v1/config`, json: true })
|
try {
|
||||||
|
const { body } = await doRequest<any>({ uri: `https://${host}/api/v1/config`, json: true })
|
||||||
|
|
||||||
const version = body.serverVersion
|
const version = body.serverVersion
|
||||||
|
|
||||||
const majorVersion = parseInt(version.split('.')[0])
|
const majorVersion = parseInt(version.split('.')[0])
|
||||||
|
|
||||||
return isNaN(majorVersion)
|
return isNaN(majorVersion)
|
||||||
? 0
|
? 0
|
||||||
: majorVersion
|
: majorVersion
|
||||||
|
} catch {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue