-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
49 lines (37 loc) · 918 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"flag"
"fmt"
"os"
"github.com/iljarotar/scalesserver/server"
"go.uber.org/zap"
)
func main() {
var host string
flag.StringVar(&host, "host", "0.0.0.0", "The host the server binds to")
var port string
flag.StringVar(&port, "port", "8080", "The port the server binds to")
var maxRange int
flag.IntVar(&maxRange, "max-range", 12, "The maximum input value for the range field")
var maxNum int
flag.IntVar(&maxNum, "max-num", 12, "The maximum input value for the notes field")
flag.Parse()
l, err := zap.NewProduction()
if err != nil {
fmt.Printf("unable to create logger, %v", err)
os.Exit(1)
}
logger := l.Sugar()
serverConfig := &server.ServerConfig{
Host: host,
Port: port,
MaxRange: maxRange,
MaxNum: maxNum,
Logger: logger,
}
scalesServer := server.NewServer(serverConfig)
err = scalesServer.Serve()
if err != nil {
os.Exit(1)
}
}