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
e4941069
Commit
e4941069
authored
10 years ago
by
verokarhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hostname flag to serve command
parent
8831427c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
cmd/ipfs/serve.go
cmd/ipfs/serve.go
+4
-1
No files found.
cmd/ipfs/serve.go
View file @
e4941069
...
...
@@ -19,6 +19,7 @@ var cmdIpfsServe = &commander.Command{
func
init
()
{
cmdIpfsServe
.
Flag
.
Uint
(
"port"
,
80
,
"Port number"
)
cmdIpfsServe
.
Flag
.
String
(
"hostname"
,
"localhost"
,
"Hostname"
)
}
func
serveCmd
(
c
*
commander
.
Command
,
_
[]
string
)
error
{
...
...
@@ -27,12 +28,14 @@ func serveCmd(c *commander.Command, _ []string) error {
return
errors
.
New
(
"invalid port number"
)
}
hostname
:=
c
.
Flag
.
Lookup
(
"hostname"
)
.
Value
.
Get
()
.
(
string
)
n
,
err
:=
localNode
()
if
err
!=
nil
{
return
err
}
address
:=
"127.0.0.1"
+
":"
+
strconv
.
FormatUint
(
uint64
(
port
),
10
)
address
:=
hostname
+
":"
+
strconv
.
FormatUint
(
uint64
(
port
),
10
)
fmt
.
Printf
(
"Serving on %s
\n
"
,
address
)
return
h
.
Serve
(
address
,
n
)
...
...
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