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-unixfs
Commits
cf60fdd3
Commit
cf60fdd3
authored
Oct 27, 2014
by
Matt Bell
Committed by
Juan Batiz-Benet
Nov 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/ipfs: Load API address from config
parent
e2ed10b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
+27
-2
cmd/ipfs/daemon.go
cmd/ipfs/daemon.go
+27
-2
No files found.
cmd/ipfs/daemon.go
View file @
cf60fdd3
...
...
@@ -5,6 +5,8 @@ import (
"net/http"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/camlistore/lock"
ma
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
manet
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr/net"
cmds
"github.com/jbenet/go-ipfs/commands"
cmdsHttp
"github.com/jbenet/go-ipfs/commands/http"
...
...
@@ -41,10 +43,33 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
}
defer
lk
.
Close
()
configFile
,
err
:=
config
.
Filename
(
configPath
)
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
}
config
,
err
:=
config
.
Load
(
configFile
)
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
}
addr
,
err
:=
ma
.
NewMultiaddr
(
config
.
Addresses
.
API
)
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
}
_
,
host
,
err
:=
manet
.
DialArgs
(
addr
)
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
}
handler
:=
cmdsHttp
.
Handler
{}
http
.
Handle
(
cmdsHttp
.
ApiPath
+
"/"
,
handler
)
// TODO: load listen address/port from config/options
err
=
http
.
ListenAndServe
(
":8080"
,
nil
)
err
=
http
.
ListenAndServe
(
host
,
nil
)
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
...
...
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