-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
36 lines (29 loc) · 732 Bytes
/
main.go
File metadata and controls
36 lines (29 loc) · 732 Bytes
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
//go:build !wasm
package main
//go:generate go get -u github.com/valyala/quicktemplate/qtc
//go:generate qtc -dir=handler
import (
"fmt"
"log"
"net/http"
"time"
"github.com/jpillora/installer/handler"
"github.com/jpillora/opts"
)
var version = "0.0.0-src"
func main() {
c := handler.DefaultConfig
opts.New(&c).Repo("github.com/cxjava/installer").Version(version).Parse()
log.Printf("default user is '%s'", c.User)
addr := fmt.Sprintf("%s:%d", c.Host, c.Port)
h := &handler.Handler{Config: c}
s := &http.Server{
Addr: addr,
Handler: h,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
MaxHeaderBytes: 1 << 20,
}
log.Fatal(s.ListenAndServe())
log.Print("exiting")
}