Skip to content

Commit

Permalink
Merge pull request #8 from ara-framework/feat/custom-port
Browse files Browse the repository at this point in the history
Feat/custom port
  • Loading branch information
marconi1992 authored Nov 16, 2019
2 parents 76bfd66 + 34ddbd0 commit de3969f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
config.json
config.json
build
22 changes: 22 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
package_name="nova-proxy"


platforms=("windows/amd64" "windows/386" "darwin/amd64")

for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
output_name=$package_name'-'$GOOS'-'$GOARCH
if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi

env GOOS=$GOOS GOARCH=$GOARCH go build -o build/$output_name
if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting the script execution...'
exit 1
fi
done
12 changes: 11 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package main
import (
"log"
"net/http"
"os"

"github.com/ara-framework/nova-proxy/config"
"github.com/gookit/color"
)

func init() {
Expand All @@ -14,5 +16,13 @@ func init() {

func main() {
config.SetUpLocations()
log.Fatal(http.ListenAndServe(":8080", nil))

port := os.Getenv("PORT")

if len(port) == 0 {
port = "8080"
}

color.Info.Printf("Nova proxy running on http://0.0.0.0:%s\n", port)
log.Fatal(http.ListenAndServe(":"+port, nil))
}

0 comments on commit de3969f

Please sign in to comment.