aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2020-04-10 00:23:26 +0100
committerGrégoire Duchêne <gduchene@awhk.org>2020-04-10 00:23:26 +0100
commitc2fb89eeb14bb710aac2c88cf16e3ce8aa468dee (patch)
tree7ecc2d1626244b2fdbd88eff66d84be364c6b025
parenta6e929541ffffe1bd37064cb0e627ca6be1acd2b (diff)
Merge ADDR and PORT
-rw-r--r--README.md12
-rw-r--r--cmd/gcp/main.go7
2 files changed, 7 insertions, 12 deletions
diff --git a/README.md b/README.md
index 6c97d53..2b975db 100644
--- a/README.md
+++ b/README.md
@@ -11,13 +11,9 @@ You need to set up the following environment variables for it to work:
e.g. `golang.org/x/` for `golang.org/x/image`, and
* `VCS` for the type of VCS you are using, e.g. `git`.
-Additionally, the version under `gcp/` will use:
-
-* `ADDR` for the address to listen on, defaulting to every address, and
-* `PORT` for the port to listen on, defaulting to 8080.
-
-See https://golang.org/pkg/net/#Dial for details of the address format.
+Additionally, the version under `gcp/` will use `ADDR` for the address
+to listen on, defaulting to every address on port 8080. See
+https://golang.org/pkg/net/#Dial for details of the address format.
If `ADDR` is set and starts with `/`, go-import-redirect will treat it
-as the path of a UNIX socket to create and listen on. `PORT` is also
-ignored.
+as the path of a UNIX socket to create and listen on.
diff --git a/cmd/gcp/main.go b/cmd/gcp/main.go
index c284bbc..c726408 100644
--- a/cmd/gcp/main.go
+++ b/cmd/gcp/main.go
@@ -60,11 +60,10 @@ func main() {
log.Fatalln("os.Chmod:", err)
}
} else {
- port := os.Getenv("PORT")
- if port == "" {
- port = "8080"
+ if addr == "" {
+ addr = ":8080"
}
- if l, err = net.Listen("tcp", os.Getenv("ADDR")+":"+port); err != nil {
+ if l, err = net.Listen("tcp", addr); err != nil {
log.Fatalln("net.Listen:", err)
}
}