cmd/ipfs: Added getConfig function

This commit is contained in:
Matt Bell 2014-10-27 17:05:48 -07:00 committed by Juan Batiz-Benet
parent cf60fdd3d9
commit 7d53e736cf
2 changed files with 10 additions and 7 deletions

View File

@ -43,13 +43,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
}
defer lk.Close()
configFile, err := config.Filename(configPath)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
config, err := config.Load(configFile)
config, err := getConfig(configPath)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return

View File

@ -149,3 +149,12 @@ func getConfigPath(req cmds.Request) (string, error) {
}
return configPath, nil
}
func getConfig(path string) (*config.Config, error) {
configFile, err := config.Filename(path)
if err != nil {
return nil, err
}
return config.Load(configFile)
}