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
73077d1f
Commit
73077d1f
authored
Sep 25, 2014
by
Shanti Bouchez-Mongardé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement ipfs init -d (change datastore location)
parent
68f1a1a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
cmd/ipfs/init.go
cmd/ipfs/init.go
+11
-3
No files found.
cmd/ipfs/init.go
View file @
73077d1f
...
...
@@ -29,6 +29,7 @@ func init() {
cmdIpfsInit
.
Flag
.
Int
(
"b"
,
4096
,
"number of bits for keypair"
)
cmdIpfsInit
.
Flag
.
String
(
"p"
,
""
,
"passphrase for encrypting keys"
)
cmdIpfsInit
.
Flag
.
Bool
(
"f"
,
false
,
"force overwrite of existing config"
)
cmdIpfsInit
.
Flag
.
String
(
"d"
,
""
,
"Change default datastore location"
)
}
func
initCmd
(
c
*
commander
.
Command
,
inp
[]
string
)
error
{
...
...
@@ -49,6 +50,11 @@ func initCmd(c *commander.Command, inp []string) error {
return
errors
.
New
(
"Couldn't get home directory path"
)
}
dspath
,
ok
:=
c
.
Flag
.
Lookup
(
"d"
)
.
Value
.
Get
()
.
(
string
)
if
!
ok
{
return
errors
.
New
(
"failed to parse datastore flag"
)
}
fi
,
err
:=
os
.
Lstat
(
filename
)
force
,
ok
:=
c
.
Flag
.
Lookup
(
"f"
)
.
Value
.
Get
()
.
(
bool
)
if
!
ok
{
...
...
@@ -62,9 +68,11 @@ func initCmd(c *commander.Command, inp []string) error {
cfg
:=
new
(
config
.
Config
)
cfg
.
Datastore
=
config
.
Datastore
{}
dspath
,
err
:=
u
.
TildeExpansion
(
"~/.go-ipfs/datastore"
)
if
err
!=
nil
{
return
err
if
len
(
dspath
)
==
0
{
dspath
,
err
=
u
.
TildeExpansion
(
"~/.go-ipfs/datastore"
)
if
err
!=
nil
{
return
err
}
}
cfg
.
Datastore
.
Path
=
dspath
cfg
.
Datastore
.
Type
=
"leveldb"
...
...
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