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>
This commit is contained in:
Steven Allen 2019-03-04 18:47:41 -08:00
parent a301a711d9
commit ebee9ff4b4
5 changed files with 0 additions and 18 deletions

View File

@ -78,10 +78,6 @@ environment variable:
},
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
cctx := env.(*oldcmds.Context)
if cctx.Online {
return cmdkit.Error{Message: "init must be run offline only"}
}
empty, _ := req.Options[emptyRepoOptionName].(bool)
nBitsForKeypair, _ := req.Options[bitsOptionName].(int)

View File

@ -207,7 +207,6 @@ func IsHidden(path string) bool {
func cmdCtx(node *core.IpfsNode, repoPath string) commands.Context {
return commands.Context{
Online: true,
ConfigRoot: repoPath,
LoadConfig: func(path string) (*config.Config, error) {
return node.Repo.Config()

View File

@ -21,7 +21,6 @@ var log = logging.Logger("command")
// Context represents request context
type Context struct {
Online bool
ConfigRoot string
ReqLog *ReqLog

View File

@ -8,8 +8,6 @@ import (
"os/exec"
"strings"
commands "github.com/ipfs/go-ipfs/commands"
cmds "gx/ipfs/QmQkW9fnCsg9SLHdViiAh6qfBppodsPZVpU92dZLqYtEfs/go-ipfs-cmds"
cmdkit "gx/ipfs/Qmde5VP1qUkyQXKCfmEUA7bP64V2HAptbJ7phuPp7jXWwg/go-ipfs-cmdkit"
)
@ -51,15 +49,6 @@ func ExternalBinary() *cmds.Command {
// setup env of child program
osenv := os.Environ()
// Get the node iff already defined.
if cctx, ok := env.(*commands.Context); ok && cctx.Online {
nd, err := cctx.GetNode()
if err != nil {
return fmt.Errorf("failed to start ipfs node: %s", err)
}
osenv = append(osenv, fmt.Sprintf("IPFS_ONLINE=%t", nd.OnlineMode()))
}
cmd.Env = osenv
err = cmd.Start()

View File

@ -62,7 +62,6 @@ func MockCmdsCtx() (commands.Context, error) {
}
return commands.Context{
Online: true,
ConfigRoot: "/tmp/.mockipfsconfig",
LoadConfig: func(path string) (*config.Config, error) {
return &conf, nil