forked from kellegous/go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
37 lines (30 loc) · 754 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
package main
import (
"flag"
"github.com/HALtheWise/o-links/context"
"github.com/HALtheWise/o-links/web"
"log"
"os"
_ "github.com/lib/pq"
)
var version string
func getVersion() string {
if version == "" {
return "none"
}
return version
}
func main() {
flagAddr := flag.String("addr", ":"+os.Getenv("PORT"), //I hope this works, used to be "8067" - I made a similar change in cmd\dump-loader
"The address that the HTTP server will bind")
flagAdmin := flag.Bool("admin", false,
"If allowing admin level requests")
flag.Parse()
ctx, err := context.Open()
if err != nil {
log.Panic(err)
}
defer ctx.Close()
log.Printf("Serving on port %s", *flagAddr)
log.Panic(web.ListenAndServe(*flagAddr, *flagAdmin, getVersion(), ctx))
}