@cryptotaxi247 / kubo / commits / 79015e789

fix(ipfs2/init) declarative

Brian Tiger Chow committed Nov 4, 2014 at 19:18 UTC 79015e78913d7ba768eeb4d3b4bfa247a2de41ae
1 file changed +24 -19
cmd/ipfs2/init.go
+24 -19
@@ -85,41 +85,46 @@ func doInit(configRoot string, dspath string, force bool, nBitsForKeypair int) e
85 return errors.New("ipfs configuration file already exists!\nReinitializing would overwrite your keys.\n(use -f to force overwrite)")
86 }
87 }
88 - cfg := new(config.Config)
88
89 ds, err := datastoreConfig(dspath)
90 if err != nil {
91 return err
92 }
94 - cfg.Datastore = ds
93
94 identity, err := identityConfig(nBitsForKeypair)
95 if err != nil {
96 return err
97 }
100 - cfg.Identity = identity
98
102 - // setup the node addresses.
103 - cfg.Addresses = config.Addresses{
104 - Swarm: "/ip4/0.0.0.0/tcp/4001",
105 - API: "/ip4/127.0.0.1/tcp/5001",
106 - }
99 + conf := config.Config{
100
108 - // setup the node mount points.
109 - cfg.Mounts = config.Mounts{
110 - IPFS: "/ipfs",
111 - IPNS: "/ipns",
112 - }
101 + // setup the node addresses.
102 + Addresses: config.Addresses{
103 + Swarm: "/ip4/0.0.0.0/tcp/4001",
104 + API: "/ip4/127.0.0.1/tcp/5001",
105 + },
106 +
107 + Bootstrap: defaultPeers,
108 +
109 + Datastore: ds,
110 +
111 + Identity: identity,
112
114 - cfg.Bootstrap = defaultPeers
113 + // setup the node mount points.
114 + Mounts: config.Mounts{
115 + IPFS: "/ipfs",
116 + IPNS: "/ipns",
117 + },
118
116 - // tracking ipfs version used to generate the init folder and adding update checker default setting.
117 - cfg.Version = config.Version{
118 - Check: "error",
119 - Current: updates.Version,
119 + // tracking ipfs version used to generate the init folder and adding
120 + // update checker default setting.
121 + Version: config.Version{
122 + Check: "error",
123 + Current: updates.Version,
124 + },
125 }
126
122 - err = config.WriteConfigFile(configFilename, cfg)
127 + err = config.WriteConfigFile(configFilename, conf)
128 if err != nil {
129 return err
130 }