diff --git a/cmd/ipfs/main.go b/cmd/ipfs/main.go index 5e943be28..9ed4de39e 100644 --- a/cmd/ipfs/main.go +++ b/cmd/ipfs/main.go @@ -220,15 +220,15 @@ func (i *cmdInvocation) Parse(ctx context.Context, args []string) error { return err } - configPath, err := getConfigRoot(i.req) + repoPath, err := getRepoPath(i.req) if err != nil { return err } - log.Debugf("config path is %s", configPath) + log.Debugf("config path is %s", repoPath) // this sets up the function that will initialize the config lazily. cmdctx := i.req.Context() - cmdctx.ConfigRoot = configPath + cmdctx.ConfigRoot = repoPath cmdctx.LoadConfig = loadConfig // this sets up the function that will initialize the node // this is so that we can construct the node lazily. @@ -415,20 +415,20 @@ func isClientError(err error) bool { return false } -func getConfigRoot(req cmds.Request) (string, error) { - configOpt, found, err := req.Option("config").String() +func getRepoPath(req cmds.Request) (string, error) { + repoOpt, found, err := req.Option("config").String() if err != nil { return "", err } - if found && configOpt != "" { - return configOpt, nil + if found && repoOpt != "" { + return repoOpt, nil } - configPath, err := config.PathRoot() + repoPath, err := fsrepo.BestKnownPath() if err != nil { return "", err } - return configPath, nil + return repoPath, nil } func loadConfig(path string) (*config.Config, error) {