forked from crony/UpFast
Set port and ip to listen on with arguments.
This commit is contained in:
parent
8b1337bdc1
commit
dd0e1b63cf
10
main.go
10
main.go
@ -3,12 +3,14 @@ package main
|
||||
import (
|
||||
"embed"
|
||||
"errors"
|
||||
"flag"
|
||||
"html/template"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v4/middleware"
|
||||
@ -25,6 +27,12 @@ func main() {
|
||||
templates: template.Must(template.ParseFS(templates, "public/views/*.html")),
|
||||
}
|
||||
|
||||
port := flag.Int("p", 1323, "upfast port to listen on.")
|
||||
adress := flag.String("a", "127.0.0.1", "upfast ip to listen to")
|
||||
flag.Parse()
|
||||
|
||||
host := *adress + ":" + strconv.Itoa(*port)
|
||||
|
||||
e := echo.New()
|
||||
|
||||
e.Renderer = t
|
||||
@ -56,7 +64,7 @@ func main() {
|
||||
|
||||
e.DELETE("/files/:file", Delete)
|
||||
|
||||
e.Logger.Fatal(e.Start(":1323"))
|
||||
e.Logger.Fatal(e.Start(host))
|
||||
}
|
||||
|
||||
type Template struct {
|
||||
|
Loading…
Reference in New Issue
Block a user