mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 07:43:12 +09:00
Add config migrations (#693)
Co-authored-by: Danielv123 <danielv@danielv.no>
This commit is contained in:
1 parent
05ca4eb25e
commit
4248e57dcb
7 files changed
+43
-9
No files matched your search
@@ -187,6 +187,16 @@ export class Config<
|
||||
declare static fieldDefinitions: ConfigDefs<any>;
|
||||
declare ["constructor"]: typeof Config;
|
||||
|
||||
/**
|
||||
* Handle migration between clusterio versions
|
||||
*
|
||||
* @param config - Input config read and validated from file
|
||||
* @returns Output config to be loaded into the class
|
||||
* @protected
|
||||
*/
|
||||
static migrations(config: Static<typeof this.jsonSchema>) {
|
||||
return config;
|
||||
}
|
||||
|
||||
fields: Fields;
|
||||
_unknownFields: Record<string, FieldValue> = {};
|
||||
@@ -223,7 +233,7 @@ export class Config<
|
||||
) as Fields;
|
||||
|
||||
if (fields) {
|
||||
this.update(fields, false, location);
|
||||
this.update(this.constructor.migrations(fields), false, location);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user