AdGuardHome/internal/configmigrate/v25.go

39 lines
626 B
Go
Raw Permalink Normal View History

2024-01-30 18:43:51 +03:00
package configmigrate
2023-09-07 17:13:48 +03:00
// 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 !ok {
return err
}
pprofObj := yobj{
"enabled": false,
"port": 6060,
}
err = moveVal[bool](diskConf, pprofObj, "debug_pprof", "enabled")
if err != nil {
return err
}
httpObj["pprof"] = pprofObj
return nil
}