My Go application provides an API which is doing health checks by contacting other internal APIs for the host passed in the request.
For example the API endpoint will be /api/v1/host/my-host-01
. In YAML configuration file app users will be specifying what healthchecks they want to be executed, it should support dynamic variables. For example config.yaml.go:
healthchecks:
hostIsAvailableInAnotherAPI:
httpGet:
path: /another-api/{{.Hostname}}
So before reading the YAML config I would render it with as a Go template on each GET request to my API with .Hostname
and only then run the health checks and provide result.
Is that a good approach to use Go template + YAML or is there a better way of doing that?