badges-backend: refactoring and support returning json as well as svg image.

Signed-off-by: Andreas Stenius <git@astekk.se>
This commit is contained in:
Andreas Stenius
2021-02-22 14:09:46 +01:00
committed by Fredrik Adelöw
parent 1cf23e05cb
commit 323ec6f7ca
9 changed files with 206 additions and 105 deletions
+22 -2
View File
@@ -1,10 +1,30 @@
# Badges Backend
Simple plugin for serving badges.
Backend plugin for serving badges. Default implementation uses
[badge-maker](https://www.npmjs.com/package/badge-maker) for creating
the badges, in svg.
## Setup
N/A
Define which badges to offer in the backend api by declaring them in
the app-config, under a `badges` key. Example:
```yaml
badges:
docs:
kind: 'entity'
target: '_{entity_url}/docs'
label: 'Documentation'
message: '_{entity.metadata.name}'
color: 'navyblue'
lifecycle:
kind: 'entity'
description: 'Entity lifecycle badge'
target: '_{entity_url}'
label: 'Lifecycle'
message: '_{entity.spec.lifecycle}'
```
## Links