google-code-export / camlistore

Automatically exported from code.google.com/p/camlistore
Apache License 2.0
0 stars 0 forks source link

Saving configuration generates invalid config file #522

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Saving the configuration from http://localhost:3179/setup/ when no database is 
configured will generate a configuration file that cannot be read back (i.e. 
you can't start the server until you remove it)

The initial configuration file has this line:
  "dbNames": null

After the save the line is (I don't have the exact value anymore, but it's a 
string with the word "nil" inside"):
  "dbNames": "..nil.." 

When restarting the server the application terminates with this error:
Error loading config file: Could not unmarshal into a serverconfig.Config: 
json: cannot unmarshal string into Go value of type map[string]string

Somewhere when marshalling to JSON the empty map is serialized as a string. I 
fixed the problem by changing the declaration of DBNames:

diff --git a/pkg/types/serverconfig/config.go b/pkg/types/serverconfig/config.go
index 75641be..f561768 100644
--- a/pkg/types/serverconfig/config.go
+++ b/pkg/types/serverconfig/config.go
@@ -71,7 +71,7 @@ type Config struct {
        //    "index"               (overrides 'dbname' key above)
        //    "queue-sync-to-index" (the sync queue to index things)
        //    "queue-sync-to-s3"    (the sync queue to replicate to s3)
-       DBNames map[string]string `json:"dbNames"`
+       DBNames map[string]string `json:"dbNames,omitempty"`

        ReplicateTo []interface{} `json:"replicateTo,omitempty"` // NOOP for now.
        // Publish maps a URL prefix path used as a root for published paths (a.k.a. a camliRoot path), to the configura

Original issue reported on code.google.com by raff...@gmail.com on 4 Oct 2014 at 12:04

GoogleCodeExporter commented 9 years ago
yeah the setup handler is lagging behind.
I guess we should fix it or nuke it.

Original comment by mathieu....@gmail.com on 4 Oct 2014 at 12:21

GoogleCodeExporter commented 9 years ago
the wizard setup is useless to advanced users and first time users should be 
able to use an automatic deployment tool soon, so we're just going to hide the 
wizard for now, unless/until someone wants to do better.

https://camlistore-review.googlesource.com/3900

Original comment by mathieu....@gmail.com on 19 Oct 2014 at 4:25

GoogleCodeExporter commented 9 years ago
This issue has moved to https://camlistore.org/issue/522

Original comment by bradfitz on 14 Dec 2014 at 11:37