Code

Include the remote server version on the index page.
authorSebastian Harl <sh@tokkee.org>
Sun, 22 Feb 2015 18:25:26 +0000 (19:25 +0100)
committerSebastian Harl <sh@tokkee.org>
Sun, 22 Feb 2015 18:25:26 +0000 (19:25 +0100)
server/server.go

index 2b0c27e9ce0dc9882c00e2d336516f9c4dfe2f48..093c683bb598eabc77e5e8ba76f80955cb39b459 100644 (file)
@@ -216,7 +216,19 @@ func (s *Server) static(w http.ResponseWriter, req request) {
 }
 
 func index(_ request, s *Server) (*page, error) {
-       return &page{Content: "<section><h1>Welcome to the System Database.</h1></section>"}, nil
+       c := <-s.conns
+       defer func() { s.conns <- c }()
+
+       major, minor, patch, extra, err := c.ServerVersion()
+       if err != nil {
+               return nil, err
+       }
+
+       content := fmt.Sprintf("<section>"+
+               "<h1>Welcome to the System Database.</h1>"+
+               "<p>Connected to SysDB %d.%d.%d%s</p>"+
+               "</section>", major, minor, patch, html(extra))
+       return &page{Content: template.HTML(content)}, nil
 }
 
 func tmpl(t *template.Template, data interface{}) (*page, error) {