first commit
This commit is contained in:
commit
581d3e6da5
11 changed files with 987 additions and 0 deletions
29
main.go
Normal file
29
main.go
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cfgPath := flag.String("config", "config.toml", "path to TOML config")
|
||||
flag.Parse()
|
||||
|
||||
cfg, err := loadConfig(*cfgPath)
|
||||
if err != nil {
|
||||
log.Fatalf("majin: %v", err)
|
||||
}
|
||||
|
||||
srv := &http.Server{
|
||||
Addr: cfg.Listen,
|
||||
Handler: newServer(cfg),
|
||||
ReadHeaderTimeout: 10 * time.Second,
|
||||
ReadTimeout: 60 * time.Second,
|
||||
WriteTimeout: 10 * time.Minute,
|
||||
IdleTimeout: 2 * time.Minute,
|
||||
}
|
||||
log.Printf("kaidan 1.0 serving %q at %s", cfg.Root, cfg.Listen)
|
||||
log.Fatal(srv.ListenAndServe())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue