// Copyright 2019 Drone.IO Inc. All rights reserved. // Use of this source code is governed by the Drone Non-Commercial License // that can be found in the LICENSE file. package web import ( "net/http" "github.com/drone/drone/version" ) // HandleVersion creates an http.HandlerFunc that returns the // version number and build details. func HandleVersion(w http.ResponseWriter, r *http.Request) { v := struct { Source string `json:"source,omitempty"` Version string `json:"version,omitempty"` Commit string `json:"commit,omitempty"` }{ Source: version.GitRepository, Commit: version.GitCommit, Version: version.Version.String(), } writeJSON(w, &v, 200) }