Commit 1b5e4032 authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Juan Batiz-Benet

refactor(init) extract context

parent f3048ab7
...@@ -51,7 +51,7 @@ var initCmd = &cmds.Command{ ...@@ -51,7 +51,7 @@ var initCmd = &cmds.Command{
nBitsForKeypair = 4096 nBitsForKeypair = 4096
} }
err := foo(res, req, dspath, force, nBitsForKeypair) err := foo(res, req.Context().ConfigRoot, dspath, force, nBitsForKeypair)
if err != nil { if err != nil {
res.SetError(err, cmds.ErrNormal) res.SetError(err, cmds.ErrNormal)
return return
...@@ -59,11 +59,10 @@ var initCmd = &cmds.Command{ ...@@ -59,11 +59,10 @@ var initCmd = &cmds.Command{
}, },
} }
func foo(res cmds.Response, req cmds.Request, dspath string, force bool, nBitsForKeypair int) error { func foo(res cmds.Response, configRoot string, dspath string, force bool, nBitsForKeypair int) error {
ctx := req.Context()
u.POut("initializing ipfs node at %s\n", ctx.ConfigRoot) u.POut("initializing ipfs node at %s\n", configRoot)
filename, err := config.Filename(ctx.ConfigRoot) filename, err := config.Filename(configRoot)
if err != nil { if err != nil {
return errors.New("Couldn't get home directory path") return errors.New("Couldn't get home directory path")
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment