Commit 79015e78 authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Juan Batiz-Benet

fix(ipfs2/init) declarative

parent e305e45e
...@@ -85,41 +85,46 @@ func doInit(configRoot string, dspath string, force bool, nBitsForKeypair int) e ...@@ -85,41 +85,46 @@ func doInit(configRoot string, dspath string, force bool, nBitsForKeypair int) e
return errors.New("ipfs configuration file already exists!\nReinitializing would overwrite your keys.\n(use -f to force overwrite)") return errors.New("ipfs configuration file already exists!\nReinitializing would overwrite your keys.\n(use -f to force overwrite)")
} }
} }
cfg := new(config.Config)
ds, err := datastoreConfig(dspath) ds, err := datastoreConfig(dspath)
if err != nil { if err != nil {
return err return err
} }
cfg.Datastore = ds
identity, err := identityConfig(nBitsForKeypair) identity, err := identityConfig(nBitsForKeypair)
if err != nil { if err != nil {
return err return err
} }
cfg.Identity = identity
// setup the node addresses. conf := config.Config{
cfg.Addresses = config.Addresses{
Swarm: "/ip4/0.0.0.0/tcp/4001",
API: "/ip4/127.0.0.1/tcp/5001",
}
// setup the node mount points. // setup the node addresses.
cfg.Mounts = config.Mounts{ Addresses: config.Addresses{
IPFS: "/ipfs", Swarm: "/ip4/0.0.0.0/tcp/4001",
IPNS: "/ipns", API: "/ip4/127.0.0.1/tcp/5001",
} },
Bootstrap: defaultPeers,
Datastore: ds,
Identity: identity,
cfg.Bootstrap = defaultPeers // setup the node mount points.
Mounts: config.Mounts{
IPFS: "/ipfs",
IPNS: "/ipns",
},
// tracking ipfs version used to generate the init folder and adding update checker default setting. // tracking ipfs version used to generate the init folder and adding
cfg.Version = config.Version{ // update checker default setting.
Check: "error", Version: config.Version{
Current: updates.Version, Check: "error",
Current: updates.Version,
},
} }
err = config.WriteConfigFile(configFilename, cfg) err = config.WriteConfigFile(configFilename, conf)
if err != nil { if err != nil {
return err return err
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment