Add hostname to labels
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Steven Polley 2019-03-05 10:14:28 -07:00
parent 85150c2792
commit 002332594c

View File

@ -9,6 +9,7 @@ import (
"math" "math"
"math/cmplx" "math/cmplx"
"net/http" "net/http"
"os"
"runtime" "runtime"
"strconv" "strconv"
"strings" "strings"
@ -174,7 +175,13 @@ func renderTile(w http.ResponseWriter, r *http.Request) {
wg.Wait() wg.Wait()
if r.FormValue("label") == "1" { 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") w.Header().Set("Content-Type", "image/png")
png.Encode(w, img) png.Encode(w, img)