Skip to content

Commit cfd9418

Browse files
committed
Fix environment vars to make scaling work
1 parent 23f0df3 commit cfd9418

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ When you push code to the repo, the cart will compile your package into <code>$O
1515

1616
$OPENSHIFT_REPO_DIR/bin/goexample
1717

18-
If you want to serve web requests (vs. running in the background), you'll need to listen on the ip address and port that OpenShift allocates - those are available as HOST and PORT in the environment.
18+
If you want to serve web requests (vs. running in the background), you'll need to listen on the ip address and port that OpenShift allocates - those are available as OPENSHIFT_GO_IP and OPENSHIFT_GO_PORT in the environment.
1919

2020
The repository contains a sample go file which will print "hello, world" when someone hits your web application - see [web.go](https://github.com/smarterclayton/openshift-go-cart/blob/master/template/web.go).
2121

@@ -31,7 +31,7 @@ When you push code to your repo, a Git postreceive hook runs and invokes the bin
3131

3232
go get -tags openshift ./...
3333

34-
on a working copy of your source. The main file that you run will have access to two environment variables, $HOST and $PORT, which contain the internal address you must listen on to receive HTTP requests to your application.
34+
on a working copy of your source. The main file that you run will have access to two environment variables, $OPENSHIFT_GO_IP and $OPENSHIFT_GO_PORT, which contain the internal address you must listen on to receive HTTP requests to your application.
3535

3636

3737
Credits

template/web.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
func main() {
1111
http.HandleFunc("/", hello)
12-
bind := fmt.Sprintf("%s:%s", os.Getenv("HOST"), os.Getenv("PORT"))
12+
bind := fmt.Sprintf("%s:%s", os.Getenv("OPENSHIFT_GO_IP"), os.Getenv("OPENSHIFT_GO_PORT"))
1313
fmt.Printf("listening on %s...", bind)
1414
err := http.ListenAndServe(bind, nil)
1515
if err != nil {

0 commit comments

Comments
 (0)