fix: get rid of useless cctx.Online option
We never set this to true outside of tests and it's unclear what it's even supposed to do. This brings us back down to _two_ online-ish options from three. fixes #5787 License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
Steven Allen committed
Mar 4, 2019 at 18:47 UTC
ebee9ff4b4d12fdfe13824ac4d15c05f1ad49480
5 files changed
-18
cmd/ipfs/init.go
-4
@@ -78,10 +78,6 @@ environment variable:
78
},
79
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
80
cctx := env.(*oldcmds.Context)
81
- if cctx.Online {
82
- return cmdkit.Error{Message: "init must be run offline only"}
83
- }
84
-
81
empty, _ := req.Options[emptyRepoOptionName].(bool)
82
nBitsForKeypair, _ := req.Options[bitsOptionName].(int)
83
cmd/ipfswatch/main.go
-1
@@ -207,7 +207,6 @@ func IsHidden(path string) bool {
207
208
func cmdCtx(node *core.IpfsNode, repoPath string) commands.Context {
209
return commands.Context{
210
- Online: true,
210
ConfigRoot: repoPath,
211
LoadConfig: func(path string) (*config.Config, error) {
212
return node.Repo.Config()
commands/context.go
-1
@@ -21,7 +21,6 @@ var log = logging.Logger("command")
21
22
// Context represents request context
23
type Context struct {
24
- Online bool
24
ConfigRoot string
25
ReqLog *ReqLog
26
core/commands/external.go
-11
@@ -8,8 +8,6 @@ import (
8
"os/exec"
9
"strings"
10
11
- commands "github.com/ipfs/go-ipfs/commands"
12
-
11
cmds "gx/ipfs/QmQkW9fnCsg9SLHdViiAh6qfBppodsPZVpU92dZLqYtEfs/go-ipfs-cmds"
12
cmdkit "gx/ipfs/Qmde5VP1qUkyQXKCfmEUA7bP64V2HAptbJ7phuPp7jXWwg/go-ipfs-cmdkit"
13
)
@@ -51,15 +49,6 @@ func ExternalBinary() *cmds.Command {
49
// setup env of child program
50
osenv := os.Environ()
51
54
- // Get the node iff already defined.
55
- if cctx, ok := env.(*commands.Context); ok && cctx.Online {
56
- nd, err := cctx.GetNode()
57
- if err != nil {
58
- return fmt.Errorf("failed to start ipfs node: %s", err)
59
- }
60
- osenv = append(osenv, fmt.Sprintf("IPFS_ONLINE=%t", nd.OnlineMode()))
61
- }
62
-
52
cmd.Env = osenv
53
54
err = cmd.Start()
core/mock/mock.go
-1
@@ -62,7 +62,6 @@ func MockCmdsCtx() (commands.Context, error) {
62
}
63
64
return commands.Context{
65
- Online: true,
65
ConfigRoot: "/tmp/.mockipfsconfig",
66
LoadConfig: func(path string) (*config.Config, error) {
67
return &conf, nil