Add hostname to labels
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Steven Polley 2019-03-05 10:14:28 -07:00
parent 85150c2792
commit 002332594c
1 changed files with 8 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import (
"math"
"math/cmplx"
"net/http"
"os"
"runtime"
"strconv"
"strings"
@ -174,7 +175,13 @@ func renderTile(w http.ResponseWriter, r *http.Request) {
wg.Wait()
if r.FormValue("label") == "1" {
addLabel(img, 10, 10, fmt.Sprintf("%d/%d/%d", tileZoom, tileX, tileY))
addLabel(img, 1, 10, fmt.Sprintf("%d/%d/%d", tileZoom, tileX, tileY))
hostname, err := os.Hostname()
if err != nil {
hostname = fmt.Sprintf("failed to get hostname: %v", err)
}
addLabel(img, 1, 22, hostname)
}
w.Header().Set("Content-Type", "image/png")
png.Encode(w, img)