badges-backend: template replace should replace all occurences.

Signed-off-by: Andreas Stenius <git@astekk.se>
This commit is contained in:
Andreas Stenius
2021-02-22 16:50:24 +01:00
committed by Fredrik Adelöw
parent 8bf248799d
commit 45e26d7956
2 changed files with 8 additions and 3 deletions
+7 -2
View File
@@ -406,10 +406,12 @@ pagerduty:
badges:
pingback:
kind: 'entity'
title: 'View _{entity.metadata.name} in _{app.title}'
description: 'Link back to _{app.title}'
link: '_{entity_url}'
label: 'View _{entity.metadata.name} in'
message: '_{app.title}'
label: '_{app.title}'
message: '_{entity.kind}: _{entity.metadata.name}'
style: flat-square
lifecycle:
kind: 'entity'
@@ -417,6 +419,7 @@ badges:
link: '_{entity_url}'
label: 'Lifecycle'
message: '_{entity.spec.lifecycle}'
style: for-the-badge
owner:
kind: 'entity'
@@ -426,6 +429,7 @@ badges:
label: 'Owner'
message: '_{entity.spec.owner}'
color: 'blue'
style: social
docs:
kind: 'entity'
@@ -433,3 +437,4 @@ badges:
label: 'Documentation'
message: '_{entity.metadata.name}'
color: 'navyblue'
style: plastic
@@ -88,7 +88,7 @@ export class DefaultBadgeBuilder implements BadgeBuilder {
private render(template: string, context: object): string {
try {
return interpolate(template.replace('_{', '${'), context);
return interpolate(template.replace(/_{/g, '${'), context);
} catch (err) {
return `${err} [${template}]`;
}