1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

New: Flag for port

This commit is contained in:
Zack Scholl 2017-03-22 08:26:34 -06:00
parent 29460a6c26
commit d3e04ef2ed
2 changed files with 8 additions and 3 deletions

View File

@ -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) {

View File

@ -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
},
},