Skip to content

Commit

Permalink
Merge pull request #10894 from knobunc/feature/hello-openshift-message
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot authored Sep 22, 2016
2 parents 930c6f3 + 45b12df commit 41bd79e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions examples/hello-openshift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ This example will serve an HTTP response of "Hello OpenShift!".
$ curl 10.1.0.2:8080
Hello OpenShift!

The response message can be set by using the RESPONSE environment variable:
$ oc set env pod/hello-openshift RESPONSE="Hello World!"

$ curl 10.1.0.2:8080
Hello World!

To test from external network, you need to create router. Please refer to [Running the router](https://github.com/openshift/origin/blob/master/docs/routing.md)

If you need to rebuild the image:
Expand Down
7 changes: 6 additions & 1 deletion examples/hello-openshift/hello_openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ import (
)

func helloHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello OpenShift!")
response := os.Getenv("RESPONSE")
if len(response) == 0 {
response = "Hello OpenShift!"
}

fmt.Fprintln(w, response)
fmt.Println("Servicing request.")
}

Expand Down

0 comments on commit 41bd79e

Please sign in to comment.