cmd/ipfs: Made daemon command use request context instead of loading config

This commit is contained in:
Matt Bell 2014-10-27 17:49:18 -07:00 committed by Juan Batiz-Benet
parent 2419ffdb2d
commit 7efa174f2d

View File

@ -24,13 +24,9 @@ var Daemon = &cmds.Command{
}
func daemonFunc(req cmds.Request, res cmds.Response) {
configPath, err := getConfigRoot(req)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
ctx := req.Context()
lockPath, err := config.Path(configPath, DaemonLockFile)
lockPath, err := config.Path(ctx.ConfigRoot, DaemonLockFile)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
@ -43,13 +39,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
}
defer lk.Close()
config, err := getConfig(configPath)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
addr, err := ma.NewMultiaddr(config.Addresses.API)
addr, err := ma.NewMultiaddr(ctx.Config.Addresses.API)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return