mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 18:37:45 +08:00
ensure node constructed is online for daemon
This commit is contained in:
parent
d3c9c5978e
commit
f43954fcd1
@ -46,12 +46,15 @@ the daemon.
|
||||
}
|
||||
|
||||
func daemonFunc(req cmds.Request) (interface{}, error) {
|
||||
cfg, err := req.Context().GetConfig()
|
||||
ctx := req.Context()
|
||||
cfg, err := ctx.GetConfig()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
node, err := core.NewIpfsNode(cfg, true)
|
||||
// make sure we construct online node.
|
||||
ctx.Online = true
|
||||
node, err := ctx.GetNode()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ func (i *cmdInvocation) constructNode() (*core.IpfsNode, error) {
|
||||
|
||||
// ok everything is good. set it on the invocation (for ownership)
|
||||
// and return it.
|
||||
i.node, err = core.NewIpfsNode(cfg, false)
|
||||
i.node, err = core.NewIpfsNode(cfg, ctx.Online)
|
||||
return i.node, err
|
||||
}
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ import (
|
||||
type optMap map[string]interface{}
|
||||
|
||||
type Context struct {
|
||||
Online bool
|
||||
ConfigRoot string
|
||||
|
||||
config *config.Config
|
||||
|
||||
Loading…
Reference in New Issue
Block a user