package apps

import (
	"log"
	"os/exec"
	"strings"

	"github.com/prometheus/client_golang/prometheus"
)

func Forgejo(m Metrics) {
	out, err := exec.Command("forgejo", "--version").Output()
	if err != nil {
		log.Printf(">> WARN: Unable to get Forgejo version: %v", err)
		return
	}

	version := strings.Split(string(out), " ")[2]

	m.Forgejo.With(prometheus.Labels{"version": version}).Set(1)
}