From 81b4b381406fc01a7588742c90c8ededbd5bf3a8 Mon Sep 17 00:00:00 2001
From: Juan Batiz-Benet <juan@benet.ai>
Date: Sun, 21 Sep 2014 03:38:09 -0700
Subject: [PATCH] RPC Address init + checks

---
 cmd/ipfs/init.go       | 5 ++++-
 cmd/ipfs/mount_unix.go | 6 ++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/cmd/ipfs/init.go b/cmd/ipfs/init.go
index 5ee86855..507959a6 100644
--- a/cmd/ipfs/init.go
+++ b/cmd/ipfs/init.go
@@ -71,7 +71,10 @@ func initCmd(c *commander.Command, inp []string) error {
 
 	cfg.Identity = new(config.Identity)
 	// This needs thought
-	cfg.Identity.Address = "/ip4/127.0.0.1/tcp/4001"
+	cfg.Identity.Address = "/ip4/127.0.0.1/tcp/5001"
+
+	// local RPC endpoint
+	cfg.RPCAddress = "/ip4/127.0.0.1/tcp/4001"
 
 	nbits, ok := c.Flag.Lookup("b").Value.Get().(int)
 	if !ok {
diff --git a/cmd/ipfs/mount_unix.go b/cmd/ipfs/mount_unix.go
index 56a802b5..0b35bfea 100644
--- a/cmd/ipfs/mount_unix.go
+++ b/cmd/ipfs/mount_unix.go
@@ -3,6 +3,7 @@
 package main
 
 import (
+	"errors"
 	"fmt"
 
 	"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gonuts/flag"
@@ -44,6 +45,11 @@ func mountCmd(c *commander.Command, inp []string) error {
 		return err
 	}
 
+	// launch the RPC endpoint.
+	if n.Config.RPCAddress == "" {
+		return errors.New("no config.RPCAddress endpoint supplied")
+	}
+
 	maddr, err := ma.NewMultiaddr(n.Config.RPCAddress)
 	if err != nil {
 		return err
-- 
GitLab