Add Docker configs

This commit is contained in:
2026-03-25 00:09:17 +01:00
parent 810d158ffe
commit b06ab3d4dd
3 changed files with 48 additions and 4 deletions

28
main.go
View File

@@ -8,6 +8,7 @@ import (
"log"
"math/rand"
"net/http"
"os"
"strconv"
"sync"
"time"
@@ -114,11 +115,30 @@ func (e *exporter) run(csvURL string, interval, jitter time.Duration) {
}
}
func envOr(key, def string) string {
if v := os.Getenv(key); v != "" {
return v
}
return def
}
func main() {
addr := flag.String("listen", ":9781", "address to listen on")
csvURL := flag.String("url", "https://www.gstatic.com/ct/compliance/endpoint_uptime_24h.csv", "URL of the uptime CSV")
interval := flag.Duration("interval", 25*time.Minute, "how often to fetch the CSV")
jitter := flag.Duration("jitter", 5*time.Minute, "maximum +/-jitter applied to the fetch interval")
addr := flag.String("listen", envOr("LISTEN", ":9781"), "address to listen on")
csvURL := flag.String("url", envOr("URL", "https://www.gstatic.com/ct/compliance/endpoint_uptime_24h.csv"), "URL of the uptime CSV")
interval := flag.Duration("interval", func() time.Duration {
d, err := time.ParseDuration(envOr("INTERVAL", "25m"))
if err != nil {
log.Fatalf("invalid INTERVAL: %v", err)
}
return d
}(), "how often to fetch the CSV")
jitter := flag.Duration("jitter", func() time.Duration {
d, err := time.ParseDuration(envOr("JITTER", "5m"))
if err != nil {
log.Fatalf("invalid JITTER: %v", err)
}
return d
}(), "maximum +/-jitter applied to the fetch interval")
flag.Parse()
reg := prometheus.NewRegistry()