@cryptotaxi247 / kubo / commits / 21887fac8

go-ipfs-config: repo: properly init Datastore config, and leave it be

We didn't previously initialize the Datastore config section. The respective function exists, but was dead code up until now. This lead to weird decisions like the GC code deciding on defaults, and writing these to the config file. Don't want GC to touch the config. License: MIT Signed-off-by: Lars Gierth <larsg@systemli.org>

Lars Gierth committed Apr 7, 2016 at 17:01 UTC 21887fac8bb04ae0f0ad34daf0cac2ad3c37e40a
1 file changed +9 -3
config/init.go
+9 -3
@@ -21,6 +21,11 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
21 return nil, err
22 }
23
24 + datastore, err := datastoreConfig()
25 + if err != nil {
26 + return nil, err
27 + }
28 +
29 conf := &Config{
30
31 // setup the node's default addresses.
@@ -35,6 +40,7 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
40 Gateway: "/ip4/127.0.0.1/tcp/8080",
41 },
42
43 + Datastore: datastore,
44 Bootstrap: BootstrapPeerStrings(bootstrapPeers),
45 Identity: identity,
46 Discovery: Discovery{MDNS{
@@ -62,12 +68,12 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
68 return conf, nil
69 }
70
65 -func datastoreConfig() (*Datastore, error) {
71 +func datastoreConfig() (Datastore, error) {
72 dspath, err := DataStorePath("")
73 if err != nil {
68 - return nil, err
74 + return Datastore{}, err
75 }
70 - return &Datastore{
76 + return Datastore{
77 Path: dspath,
78 Type: "leveldb",
79 StorageMax: "10GB",