Skip to content

Commit

Permalink
Rename ADDR evnrironment variable to PORT (semantics :))
Browse files Browse the repository at this point in the history
  • Loading branch information
lon-io authored and Excellence Ilesanmi committed Apr 1, 2018
1 parent 65ad5ab commit a5793bc
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion example.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ADDR=8080
PORT=8080
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ func main() {
// web server
func run() error {
mux := makeMuxRouter()
httpAddr := os.Getenv("ADDR")
log.Println("Listening on ", os.Getenv("ADDR"))
httpPort := os.Getenv("PORT")
log.Println("HTTP Server Listening on port :", httpPort)
s := &http.Server{
Addr: ":" + httpAddr,
Addr: ":" + httpPort,
Handler: mux,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
Expand Down
2 changes: 1 addition & 1 deletion networking/example.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ADDR=9000
PORT=9000
5 changes: 4 additions & 1 deletion networking/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ func main() {
spew.Dump(genesisBlock)
Blockchain = append(Blockchain, genesisBlock)

httpPort := os.Getenv("PORT")

// start TCP and serve TCP server
server, err := net.Listen("tcp", ":"+os.Getenv("ADDR"))
server, err := net.Listen("tcp", ":"+httpPort)
if err != nil {
log.Fatal(err)
}
log.Println("HTTP Server Listening on port :", httpPort)
defer server.Close()

for {
Expand Down
2 changes: 1 addition & 1 deletion proof-stake/example.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ADDR=9000
PORT=9000
5 changes: 4 additions & 1 deletion proof-stake/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ func main() {
spew.Dump(genesisBlock)
Blockchain = append(Blockchain, genesisBlock)

httpPort := os.Getenv("PORT")

// start TCP and serve TCP server
server, err := net.Listen("tcp", ":"+os.Getenv("ADDR"))
server, err := net.Listen("tcp", ":"+httpPort)
if err != nil {
log.Fatal(err)
}
log.Println("HTTP Server Listening on port :", httpPort)
defer server.Close()

go func() {
Expand Down
2 changes: 1 addition & 1 deletion proof-work/example.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ADDR=8080
PORT=8080
6 changes: 3 additions & 3 deletions proof-work/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ func main() {
// web server
func run() error {
mux := makeMuxRouter()
httpAddr := os.Getenv("ADDR")
log.Println("Listening on ", os.Getenv("ADDR"))
httpPort := os.Getenv("PORT")
log.Println("HTTP Server Listening on port :", httpPort)
s := &http.Server{
Addr: ":" + httpAddr,
Addr: ":" + httpPort,
Handler: mux,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
Expand Down

0 comments on commit a5793bc

Please sign in to comment.