mirror of https://github.com/docker/docs.git
Merge pull request #220 from vieux/apiversion
add more fields to /version
This commit is contained in:
commit
12d4cf53f7
20
api/api.go
20
api/api.go
|
@ -17,6 +17,8 @@ import (
|
||||||
"github.com/samalba/dockerclient"
|
"github.com/samalba/dockerclient"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const APIVERSION = "1.16"
|
||||||
|
|
||||||
type context struct {
|
type context struct {
|
||||||
cluster *cluster.Cluster
|
cluster *cluster.Cluster
|
||||||
scheduler *scheduler.Scheduler
|
scheduler *scheduler.Scheduler
|
||||||
|
@ -53,13 +55,19 @@ func getInfo(c *context, w http.ResponseWriter, r *http.Request) {
|
||||||
// GET /version
|
// GET /version
|
||||||
func getVersion(c *context, w http.ResponseWriter, r *http.Request) {
|
func getVersion(c *context, w http.ResponseWriter, r *http.Request) {
|
||||||
version := struct {
|
version := struct {
|
||||||
Version string
|
Version string
|
||||||
GoVersion string
|
ApiVersion string
|
||||||
GitCommit string
|
GoVersion string
|
||||||
|
GitCommit string
|
||||||
|
Os string
|
||||||
|
Arch string
|
||||||
}{
|
}{
|
||||||
Version: "swarm/" + c.version,
|
Version: "swarm/" + c.version,
|
||||||
GoVersion: runtime.Version(),
|
ApiVersion: APIVERSION,
|
||||||
GitCommit: "n/a",
|
GoVersion: runtime.Version(),
|
||||||
|
GitCommit: "n/a",
|
||||||
|
Os: runtime.GOOS,
|
||||||
|
Arch: runtime.GOARCH,
|
||||||
}
|
}
|
||||||
|
|
||||||
json.NewEncoder(w).Encode(version)
|
json.NewEncoder(w).Encode(version)
|
||||||
|
|
Loading…
Reference in New Issue