diff --git a/handlers.go b/handlers.go index e569564..0e20a16 100755 --- a/handlers.go +++ b/handlers.go @@ -10,7 +10,7 @@ import ( "github.com/gin-gonic/gin" ) -func serve() { +func serve(port string) { router := gin.Default() router.LoadHTMLGlob("templates/*") router.Use(static.Serve("/static/", static.LocalFile("./static", true))) @@ -28,7 +28,7 @@ func serve() { router.POST("/lock", handleLock) router.POST("/encrypt", handleEncrypt) - router.Run(":8050") + router.Run(":" + port) } func handlePageRequest(c *gin.Context) { diff --git a/main.go b/main.go index c84492c..6eb63f0 100755 --- a/main.go +++ b/main.go @@ -32,6 +32,11 @@ func main() { Value: "", Usage: "data folder for migrating", }, + cli.StringFlag{ + Name: "port,p", + Value: "8050", + Usage: "port to use", + }, cli.BoolFlag{ Name: "debug, d", Usage: "turn on debugging", @@ -45,7 +50,7 @@ func main() { Action: func(c *cli.Context) error { pathToData = c.GlobalString("data") os.MkdirAll(pathToData, 0755) - serve() + serve(c.GlobalString("port")) return nil }, },