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
9e67acf5
Commit
9e67acf5
authored
Jan 06, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bootstrap add --default option
parent
517d3e99
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
core/commands/bootstrap.go
core/commands/bootstrap.go
+25
-1
No files found.
core/commands/bootstrap.go
View file @
9e67acf5
...
...
@@ -63,8 +63,13 @@ in the bootstrap list).
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"peer"
,
true
,
true
,
peerOptionDesc
),
cmds
.
StringArg
(
"peer"
,
false
,
true
,
peerOptionDesc
),
},
Options
:
[]
cmds
.
Option
{
cmds
.
BoolOption
(
"default"
,
"add default bootstrap nodes"
),
},
Run
:
func
(
req
cmds
.
Request
)
(
interface
{},
error
)
{
inputPeers
,
err
:=
config
.
ParseBootstrapPeers
(
req
.
Arguments
())
if
err
!=
nil
{
...
...
@@ -81,11 +86,30 @@ in the bootstrap list).
return
nil
,
err
}
deflt
,
_
,
err
:=
req
.
Option
(
"default"
)
.
Bool
()
if
err
!=
nil
{
return
nil
,
err
}
if
deflt
{
// parse separately for meaningful, correct error.
defltPeers
,
err
:=
DefaultBootstrapPeers
()
if
err
!=
nil
{
return
nil
,
err
}
inputPeers
=
append
(
inputPeers
,
defltPeers
...
)
}
added
,
err
:=
bootstrapAdd
(
filename
,
cfg
,
inputPeers
)
if
err
!=
nil
{
return
nil
,
err
}
if
len
(
inputPeers
)
==
0
{
return
nil
,
cmds
.
ClientError
(
"no bootstrap peers to add"
)
}
return
&
BootstrapOutput
{
added
},
nil
},
Type
:
&
BootstrapOutput
{},
...
...
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