Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 035fbe83 authored by Bastien Gounon's avatar Bastien Gounon 🐗
Browse files

ability to set port at server start

parent c7143a5b
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"flag" "flag"
"log" "log"
"net/http" "net/http"
"strconv"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
...@@ -11,7 +12,10 @@ import ( ...@@ -11,7 +12,10 @@ import (
func main() { func main() {
var dir, serverToken string var dir, serverToken string
var port int
flag.StringVar(&dir, "cachedir", "", "Folder where the cache is stored") flag.StringVar(&dir, "cachedir", "", "Folder where the cache is stored")
flag.IntVar(&port, "port", 8080, "Network port where the server should listen")
flag.StringVar(&serverToken, "token", "", " optional - Token for user authentication") flag.StringVar(&serverToken, "token", "", " optional - Token for user authentication")
flag.Parse() flag.Parse()
...@@ -20,6 +24,7 @@ func main() { ...@@ -20,6 +24,7 @@ func main() {
} }
r := gin.Default() r := gin.Default()
r.DELETE("/flush", func(c *gin.Context) { r.DELETE("/flush", func(c *gin.Context) {
userToken := c.Query("token") userToken := c.Query("token")
if userToken != serverToken { if userToken != serverToken {
...@@ -34,5 +39,5 @@ func main() { ...@@ -34,5 +39,5 @@ func main() {
} }
}) })
r.Run() r.Run(":" + strconv.Itoa(port))
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment