This commit is contained in:
parent
90cb4bc674
commit
9761710bd1
|
@ -31,20 +31,21 @@ type Stat struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var hostPort,baseURL,database string
|
hostPort := flag.String("http", ":80", "host and port to listen on")
|
||||||
flag.StringVar(&hostPort, "http", ":80", "host and port to listen on")
|
baseURL := flag.String("baseurl", "", "baseurl that the server should response with")
|
||||||
flag.StringVar(&baseURL, "baseurl", "", "baseurl that the server should response with")
|
database := flag.String("database", "localhost:9999", "database hostpost")
|
||||||
flag.StringVar(&database, "database", "localhost:9999", "database hostpost")
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
dsn := fmt.Sprintf("postgres://%v:%v@%s/hub?sslmode=disable", "postgres", "simple", database)
|
log.Printf("Using arguments http=%s baseurl=%s database=%s", *hostPort, *baseURL, *database)
|
||||||
|
|
||||||
|
dsn := fmt.Sprintf("postgres://%v:%v@%s/hub?sslmode=disable", "postgres", "simple", *database)
|
||||||
store, err := storage.New(dsn)
|
store, err := storage.New(dsn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
defer store.Close()
|
defer store.Close()
|
||||||
|
|
||||||
handler := &subscriptionHandler{store, baseURL}
|
handler := &subscriptionHandler{store, *baseURL}
|
||||||
http.Handle("/", handler)
|
http.Handle("/", handler)
|
||||||
log.Fatal(http.ListenAndServe(hostPort, nil))
|
log.Fatal(http.ListenAndServe(*hostPort, nil))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user