@@ -21,7 +21,7 @@ type Configuration struct {
2121 ServerConfig struct {
2222 WebsiteHost string `json:"websitehost"`
2323 CenterHost string `json:"centerhost"`
24- Storage map [string ]interface {} `json:"storage "`
24+ StorageDriver map [string ]interface {} `json:"storagedriver "`
2525 } `json:"serverconfig"`
2626}
2727
@@ -39,8 +39,14 @@ func initServerConfigData(conf *Configuration) (string, []byte, error) {
3939 return "" , nil , err
4040 }
4141
42- <- event
4342 defer conn .Close ()
43+ <- event
44+ if ret , _ , _ := conn .Exists (conf .Zookeeper .Root ); ! ret {
45+ if _ , err := conn .Create (conf .Zookeeper .Root , []byte {}, zkFlags , zkACL ); err != nil {
46+ return "" , nil , fmt .Errorf ("zookeeper root: %s failure" , conf .Zookeeper .Root )
47+ }
48+ }
49+
4450 serverConfigPath := conf .Zookeeper .Root + "/ServerConfig"
4551 ret , _ , err := conn .Exists (serverConfigPath )
4652 if err != nil {
@@ -84,7 +90,7 @@ func main() {
8490
8591 conf , err := readConfiguration ()
8692 if err != nil {
87- fmt .Errorf ("ServerConfig.json invalid, %s" , err )
93+ fmt .Printf ("ServerConfig.json invalid, %s" , err )
8894 return
8995 }
9096
@@ -98,10 +104,10 @@ func main() {
98104
99105 path , data , err := initServerConfigData (conf )
100106 if err != nil {
101- fmt .Errorf ("init server config failure, %s" , err )
107+ fmt .Printf ("init server config failure, %s" , err )
102108 return
103109 }
104110 fmt .Printf ("zookeeper path: %s\n " , path )
105- fmt .Printf ("data : %s\n " , string (data ))
106- fmt .Printf ("init to zookeeper successed!\n " )
111+ fmt .Printf ("serverconfig : %s\n " , string (data ))
112+ fmt .Printf ("initconfig to zookeeper successed!\n " )
107113}
0 commit comments