mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 23:24:52 +09:00
Fix controller not accepting old hosts.json format
Migrate the content of the hosts.json file before attempting to loading it into the new datastore format.
This commit is contained in:
1 parent
33c9542524
commit
7547a48fd6
1 file changed
+4
-4
@@ -577,11 +577,11 @@ export default class Controller {
|
||||
}
|
||||
|
||||
static migrateHosts(rawJson: unknown[]): Static<typeof HostInfo.jsonSchema>[] {
|
||||
const serialized = rawJson as Static<typeof HostInfo.jsonSchema>[];
|
||||
let serialized = rawJson as any;
|
||||
|
||||
// TODO: migrate remove after release.
|
||||
if (serialized.length && !(serialized[0] instanceof Array)) {
|
||||
return []; // Discard old format.
|
||||
// migrate from pre alpha.19 format
|
||||
if (serialized.length && serialized[0] instanceof Array) {
|
||||
serialized = serialized.map((e: any) => e[1]);
|
||||
}
|
||||
|
||||
return serialized;
|
||||
|
||||
Reference in new issue
Block a user