Skip to content

Commit

Permalink
Refactor server port configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
minpeter committed Mar 25, 2024
1 parent 296f969 commit bde5a36
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"log"
"net/http"
"os"
"strconv"

"github.com/go-fuego/fuego"
"github.com/rs/cors"
Expand Down Expand Up @@ -34,9 +33,9 @@ func main() {
os.Setenv("BACKEND_PORT", "5000")
}

port, _ := strconv.Atoi(os.Getenv("BACKEND_PORT"))
port := os.Getenv("BACKEND_PORT")
s := fuego.NewServer(
fuego.WithPort(port),
fuego.WithAddr("0.0.0.0:"+port),
fuego.WithCorsMiddleware(cors.New(cors.Options{
AllowedOrigins: []string{"*"},
AllowedMethods: []string{http.MethodGet, http.MethodPost, http.MethodDelete},
Expand Down

0 comments on commit bde5a36

Please sign in to comment.