mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-29 16:13:47 +00:00
33 lines
603 B
Go
33 lines
603 B
Go
package server
|
|
|
|
import (
|
|
"fmt"
|
|
"io/ioutil"
|
|
|
|
"github.com/BurntSushi/toml"
|
|
)
|
|
|
|
func readLegacyConfig(path string) (*Config, error) {
|
|
data, err := ioutil.ReadFile(path)
|
|
tomlData := string(data)
|
|
|
|
if err != nil {
|
|
return nil, fmt.Errorf("failed to read toml config file: %v", err)
|
|
}
|
|
|
|
conf := *DefaultConfig()
|
|
|
|
if _, err := toml.Decode(tomlData, &conf); err != nil {
|
|
return nil, fmt.Errorf("failed to decode toml config file: %v", err)
|
|
}
|
|
|
|
if err := conf.fillBigInt(); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
if err := conf.fillTimeDurations(); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &conf, nil
|
|
}
|