Cocov

Badger

Last updated Feb 26, 2024

Badger is a small application responsible for creating badges with counters like the ones commonly found on GitHub READMEs:

Coverage Badge Issues Counter Badge
coverage: 97%coverage97% issues: 4issues4

This service is expected to be exposed to the internet. For instance, if users attempt to embed this on a README hosted on GitHub, GitHub will attempt to proxy it, meaning it won’t be able to access it in case the service is behind a VPN, firewall, or the likes.

Currently, Badger only allows badges to be created for a repository’s default branch, and exposes only two routes:

Route Description
/{repository-name}/coverage Returns an SVG image showing the coverage percentage for the repository’s default branch
/{repository-name}/issues Returns an SVG image showing the amount of issues present in the repository’s default branch

Configuration Options #

Badger is as simple as the Web UI component, requiring only the API URL and a Service Token:

Variable Name Description
COCOV_BADGER_BIND_ADDRESS The address to bind the HTTP server to. Defaults to 127.0.0.1
COCOV_BADGER_BIND_PORT The port to bing the HTTP server to. Defaults to 4000
COCOV_BADGER_API_URL Base URL to the system’s API. Can be an internal URL, if desired. Format is http[s]://api_hostname[:port]
COCOV_BADGER_API_SERVICE_TOKEN A Service Token created by the API to allow Badger requests.