cmd/ipfs: Made daemon command use request context instead of loading config
Matt Bell committed
Oct 27, 2014 at 17:49 UTC
7efa174f2d7b59ed7cd5b6bdd9202e113e08ecb0
1 file changed
+3
-13
cmd/ipfs/daemon.go
+3
-13
@@ -24,13 +24,9 @@ var Daemon = &cmds.Command{
24
}
25
26
func daemonFunc(req cmds.Request, res cmds.Response) {
27
- configPath, err := getConfigRoot(req)
28
- if err != nil {
29
- res.SetError(err, cmds.ErrNormal)
30
- return
31
- }
27
+ ctx := req.Context()
28
33
- lockPath, err := config.Path(configPath, DaemonLockFile)
29
+ lockPath, err := config.Path(ctx.ConfigRoot, DaemonLockFile)
30
if err != nil {
31
res.SetError(err, cmds.ErrNormal)
32
return
@@ -43,13 +39,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
39
}
40
defer lk.Close()
41
46
- config, err := getConfig(configPath)
47
- if err != nil {
48
- res.SetError(err, cmds.ErrNormal)
49
- return
50
- }
51
-
52
- addr, err := ma.NewMultiaddr(config.Addresses.API)
42
+ addr, err := ma.NewMultiaddr(ctx.Config.Addresses.API)
43
if err != nil {
44
res.SetError(err, cmds.ErrNormal)
45
return