Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
aea52132
Commit
aea52132
authored
10 years ago
by
Matt Bell
Committed by
Juan Batiz-Benet
10 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/ipfs: Initialize IpfsNode when running locally or starting daemon
parent
7b2f4488
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
cmd/ipfs/daemon.go
cmd/ipfs/daemon.go
+8
-2
cmd/ipfs/ipfs.go
cmd/ipfs/ipfs.go
+8
-1
No files found.
cmd/ipfs/daemon.go
View file @
aea52132
...
...
@@ -9,6 +9,7 @@ import (
cmds
"github.com/jbenet/go-ipfs/commands"
cmdsHttp
"github.com/jbenet/go-ipfs/commands/http"
"github.com/jbenet/go-ipfs/core"
"github.com/jbenet/go-ipfs/daemon"
)
...
...
@@ -20,10 +21,15 @@ var Daemon = &cmds.Command{
}
func
daemonFunc
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
// TODO: spin up a core.IpfsNode
ctx
:=
req
.
Context
()
node
,
err
:=
core
.
NewIpfsNode
(
ctx
.
Config
,
true
)
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
}
ctx
.
Node
=
node
lk
,
err
:=
daemon
.
Lock
(
ctx
.
ConfigRoot
)
if
err
!=
nil
{
res
.
SetError
(
fmt
.
Errorf
(
"Couldn't obtain lock. Is another daemon already running?"
),
cmds
.
ErrNormal
)
...
...
This diff is collapsed.
Click to expand it.
cmd/ipfs/ipfs.go
View file @
aea52132
...
...
@@ -10,6 +10,7 @@ import (
cmdsCli
"github.com/jbenet/go-ipfs/commands/cli"
cmdsHttp
"github.com/jbenet/go-ipfs/commands/http"
"github.com/jbenet/go-ipfs/config"
"github.com/jbenet/go-ipfs/core"
"github.com/jbenet/go-ipfs/core/commands"
"github.com/jbenet/go-ipfs/daemon"
u
"github.com/jbenet/go-ipfs/util"
...
...
@@ -110,7 +111,13 @@ func main() {
}
}
else
{
// TODO: spin up node
node
,
err
:=
core
.
NewIpfsNode
(
conf
,
false
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
os
.
Exit
(
1
)
}
ctx
.
Node
=
node
res
=
root
.
Call
(
req
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment