cloud-run-hello icon indicating copy to clipboard operation
cloud-run-hello copied to clipboard

feat: add info endpoint for data as json format

Open danistrebel opened this issue 1 year ago • 1 comments

Problem Statement

Current implementation mainly targets an HTML based UI demo.

In my experience this makes the following use cases less elegant to demo:

  1. Authentication with just a simple cURL command
  2. Show load balancing distribution e.g. based on the color value in an automated capture.
  3. 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"
}

danistrebel avatar Jan 03 '24 13:01 danistrebel

cc @steren @grayside for merging

JulienBreux avatar Jul 12 '24 09:07 JulienBreux