19 lines
416 B
Go
19 lines
416 B
Go
package handlers
|
|
|
|
import (
|
|
"docker-manager/docker"
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
func InfoHandler(w http.ResponseWriter, r *http.Request, client *docker.Client) {
|
|
var info map[string]interface{}
|
|
if err := client.GetJSON("/info", &info); err != nil {
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
return
|
|
}
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
json.NewEncoder(w).Encode(info)
|
|
}
|