mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-24 20:07:45 +08:00
cmd/ipfs: Made daemon command use request context instead of loading config
This commit is contained in:
parent
2419ffdb2d
commit
7efa174f2d
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user