Skip to content

Commit

Permalink
Merge pull request nosequeldeebee#11 from lon-io/master
Browse files Browse the repository at this point in the history
Rename ADDR environment variable to PORT (semantics :))
  • Loading branch information
nosequeldeebee authored Apr 1, 2018
2 parents 65ad5ab + a5793bc commit 0258050
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 0258050

Please sign in to comment.