mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
New: Flag for port
Former-commit-id: 2d0a3148379cc650552887358558b05b8efd2545 [formerly b5bbb0e6df504588c406ffea0b7f68ff18b34ff9] [formerly 1cded1417754d12f2ea94246e1e22bc8a7c8631a [formerly d3e04ef2ed
]]
Former-commit-id: be9e181ffd0c1d00666928618237f709760f8f72 [formerly f6f73dc9e043e6b96b190cbfe9011c3e1c7b83a3]
Former-commit-id: 1a016d36925db45aac5786e552ae7c9f7ccde722
This commit is contained in:
parent
64b3fdb0d4
commit
d46fe9cb6a
@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func serve() {
|
func serve(port string) {
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
router.LoadHTMLGlob("templates/*")
|
router.LoadHTMLGlob("templates/*")
|
||||||
router.Use(static.Serve("/static/", static.LocalFile("./static", true)))
|
router.Use(static.Serve("/static/", static.LocalFile("./static", true)))
|
||||||
@ -28,7 +28,7 @@ func serve() {
|
|||||||
router.POST("/lock", handleLock)
|
router.POST("/lock", handleLock)
|
||||||
router.POST("/encrypt", handleEncrypt)
|
router.POST("/encrypt", handleEncrypt)
|
||||||
|
|
||||||
router.Run(":8050")
|
router.Run(":" + port)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handlePageRequest(c *gin.Context) {
|
func handlePageRequest(c *gin.Context) {
|
||||||
|
7
main.go
7
main.go
@ -32,6 +32,11 @@ func main() {
|
|||||||
Value: "",
|
Value: "",
|
||||||
Usage: "data folder for migrating",
|
Usage: "data folder for migrating",
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "port,p",
|
||||||
|
Value: "8050",
|
||||||
|
Usage: "port to use",
|
||||||
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug, d",
|
Name: "debug, d",
|
||||||
Usage: "turn on debugging",
|
Usage: "turn on debugging",
|
||||||
@ -45,7 +50,7 @@ func main() {
|
|||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
pathToData = c.GlobalString("data")
|
pathToData = c.GlobalString("data")
|
||||||
os.MkdirAll(pathToData, 0755)
|
os.MkdirAll(pathToData, 0755)
|
||||||
serve()
|
serve(c.GlobalString("port"))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user