go-pkg/cmd/mercury/app.info.go
2024-02-15 11:58:37 -07:00

30 lines
541 B
Go

package main
import (
"context"
"fmt"
"net/http"
"go.sour.is/pkg/lg"
"go.sour.is/pkg/service"
)
var _ = apps.Register(50, func(ctx context.Context, svc *service.Harness) error {
_, span := lg.Span(ctx)
defer span.End()
svc.Add(&info{})
return nil
})
type info struct{}
func (info) RegisterHTTP(mux *http.ServeMux) {}
func (info) RegisterAPIv1(mux *http.ServeMux) {
mux.HandleFunc("/app-info", func(w http.ResponseWriter, r *http.Request) {
_, version := service.AppName()
fmt.Fprint(w, "mercury", " :: ", version)
})
}