mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-29 10:28:53 +03:00
40 lines
638 B
Go
40 lines
638 B
Go
|
package confmigrate
|
||
|
|
||
|
// migrateTo25 performs the following changes:
|
||
|
//
|
||
|
// # BEFORE:
|
||
|
// 'schema_version': 24
|
||
|
// 'debug_pprof': true
|
||
|
// # …
|
||
|
//
|
||
|
// # AFTER:
|
||
|
// 'schema_version': 25
|
||
|
// 'http':
|
||
|
// 'pprof':
|
||
|
// 'enabled': true
|
||
|
// 'port': 6060
|
||
|
// # …
|
||
|
func migrateTo25(diskConf yobj) (err error) {
|
||
|
diskConf["schema_version"] = 25
|
||
|
|
||
|
httpObj, ok, err := fieldVal[yobj](diskConf, "http")
|
||
|
if err != nil {
|
||
|
return err
|
||
|
} else if !ok {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
pprofObj := yobj{
|
||
|
"port": 6060,
|
||
|
}
|
||
|
|
||
|
err = moveVal[bool](diskConf, pprofObj, "debug_pprof", "enabled")
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
httpObj["pprof"] = pprofObj
|
||
|
|
||
|
return nil
|
||
|
}
|