-
Notifications
You must be signed in to change notification settings - Fork 49
/
main.go
46 lines (37 loc) · 952 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
package main
import (
"math/rand"
"net/http"
"os"
"time"
// "github.com/lbryio/lbryweb.go/assets"
"github.com/lbryio/lbryweb.go/monitor"
"github.com/lbryio/lbryweb.go/server"
log "github.com/sirupsen/logrus"
)
var (
version = "dev"
commit = "none"
date = "unknown"
)
func main() {
rand.Seed(time.Now().UnixNano())
monitor.SetupLogging()
// this is a *client-side* timeout (for when we make http requests, not when we serve them)
//https://blog.cloudflare.com/the-complete-guide-to-golang-net-http-timeouts/
http.DefaultClient.Timeout = 20 * time.Second
if len(os.Args) < 2 {
log.Errorf("Usage: %s COMMAND", os.Args[0])
return
}
command := os.Args[1]
switch command {
case "version":
log.Printf("lbryweb %v, commit %v, built at %v", version, commit, date)
case "serve":
log.Printf("lbryweb %v starting", version)
server.ServeUntilInterrupted()
default:
log.Errorf("Invalid command: '%s'\n", command)
}
}