Skip to content

Commit 0123722

Browse files
authored
Configurate listen port (#18)
* Update main.go * Fix codefresh pipeline
1 parent 180c017 commit 0123722

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

codefresh/preview.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ steps:
5555
type: build
5656
description: "Build test image"
5757
dockerfile: Dockerfile
58-
image_name: ${{CF_REPO_NAME}}
58+
image_name: ${{CF_DOCKER_REPO_URL}}/${{CF_REPO_NAME}}
5959
tag: ${{CF_SHORT_REVISION}}-test
6060
when:
6161
condition:

main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@ func main() {
1414
if len(c) == 0 {
1515
c = "cyan"
1616
}
17+
18+
addr := os.Getenv("LISTEN")
19+
if len(addr) == 0 {
20+
addr = ":8080"
21+
}
22+
1723
count := 0
1824

1925
m := http.NewServeMux()
20-
s := http.Server{Addr: ":8080", Handler: m}
26+
s := http.Server{Addr: addr, Handler: m}
2127

2228
log.Printf("Server started\n")
2329

0 commit comments

Comments
 (0)