-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
33 lines (25 loc) · 788 Bytes
/
main.go
File metadata and controls
33 lines (25 loc) · 788 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
package main
import (
"log"
"net/http"
"rq/config"
"rq/files"
"rq/storage"
)
func main() {
// TODO: Move profile selection to CLI arg / env var
if err := config.LoadConfigFile("default"); err != nil {
log.Fatal("Could not load config file", err)
}
addServerExcludedHeaders(&config.Config.Server.ExcludedHeaders)
mux := http.NewServeMux()
databaseStore, err := storage.NewSqliteRecordStore(config.Config.Database.Filepath)
fileStore, err := files.NewDiskFileStore()
if err != nil {
log.Fatal("error opening database connection: ", err)
}
recordServer := &RecordServer{databaseStore, fileStore}
//HttpRequestHandler := http.HandlerFunc(QueueHttpHandler)
mux.Handle("/api/rq/http", RqHttpMiddleware(recordServer))
log.Fatal(http.ListenAndServe(":8080", mux))
}