Read env vars USERNAME and MY_POD_NAME

This commit is contained in:
2023-09-06 15:26:21 +03:00
parent 8d03b79a29
commit 6c61682771
2 changed files with 4 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/penglongli/gin-metrics/ginmetrics"
"net/http"
"os"
)
func main() {
@@ -14,7 +15,7 @@ func main() {
metrics.Use(router)
router.GET("/api/v1/gin", func(c *gin.Context) {
c.String(http.StatusOK, "Hello from Go!")
c.String(http.StatusOK, "Hello " + os.Getenv("USERNAME") + " from " + os.Getenv("MY_POD_NAME"))
})
router.Run(":8000")