Get chunk size from env
continuous-integration/drone/push Build is passing Details

This commit is contained in:
nemunaire 2020-11-19 01:38:53 +01:00
parent 80b18c450d
commit e18bd07582
1 changed files with 9 additions and 2 deletions

11
main.go
View File

@ -9,11 +9,13 @@ import (
"log"
"math/rand"
"net/http"
"os"
"strconv"
"strings"
"time"
)
var chunkSize uint = 2
var chunkSize = 2
var currentChunk string
func init() {
@ -120,9 +122,14 @@ func ServeScores(w http.ResponseWriter, r *http.Request) {
}
func main() {
if v, exists := os.LookupEnv("CHUNKSIZE"); exists {
if cs, err := strconv.Atoi(v); err == nil {
chunkSize = cs
}
}
var bind = flag.String("bind", "0.0.0.0:8081", "Bind port/socket")
var dsn = flag.String("dsn", DSNGenerator(), "DSN to connect to the MySQL server")
flag.UintVar(&chunkSize, "chunkSize", chunkSize, "Taille du chunk à trouver")
flag.IntVar(&chunkSize, "chunkSize", chunkSize, "Taille du chunk à trouver")
flag.Parse()
newChunk()