cloud-run-hello
cloud-run-hello copied to clipboard
feat: add info endpoint for data as json format
Problem Statement
Current implementation mainly targets an HTML based UI demo.
In my experience this makes the following use cases less elegant to demo:
- Authentication with just a simple cURL command
- Show load balancing distribution e.g. based on the color value in an automated capture.
- Call a service from a bastion host that can't show the rendered HTML page
Proposal
Add /info endpoint that directly outputs the existing data struct without the HTML template.
Demo
Service
K_SERVICE=foo K_REVISION=bar COLOR=my-color go run hello.go
Client
curl localhost:8080/info
response
{
"Service": "foo",
"Revision": "bar",
"Project": "my-host",
"Region": "europe-west1-d",
"AuthenticatedEmail": "",
"Color": "my-color"
}
cc @steren @grayside for merging