GET /api/v1/version
parent
fbd151f9ef
commit
b2f64037e2
7
main.go
7
main.go
|
|
@ -85,6 +85,7 @@ func listenAndServe(ctx context.Context, cfg Config) chan error {
|
|||
func newHandler(cfg Config) http.HandlerFunc {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.Handle("GET /api/v1/version", http.HandlerFunc(newHandlerGetAPIV1Version))
|
||||
mux.Handle("POST /api/v1/events/slack", http.HandlerFunc(newHandlerPostAPIV1EventsSlack(cfg)))
|
||||
mux.Handle("PUT /api/v1/rpc/scrapeslack", http.HandlerFunc(newHandlerPutAPIV1RPCScrapeSlack(cfg)))
|
||||
|
||||
|
|
@ -99,6 +100,12 @@ func newHandler(cfg Config) http.HandlerFunc {
|
|||
}
|
||||
}
|
||||
|
||||
var Version = "undef"
|
||||
|
||||
func newHandlerGetAPIV1Version(w http.ResponseWriter, _ *http.Request) {
|
||||
json.NewEncoder(w).Encode(map[string]any{"version": Version})
|
||||
}
|
||||
|
||||
func newHandlerPutAPIV1RPCScrapeSlack(cfg Config) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if !basicAuth(cfg, w, r) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue