forked from electricdusk/rushlink
34 lines
869 B
Go
34 lines
869 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"log"
|
|
|
|
"gitea.hashru.nl/dsprenkels/rushlink"
|
|
"gitea.hashru.nl/dsprenkels/rushlink/internal/db"
|
|
)
|
|
|
|
var (
|
|
databasePath = flag.String("database", "", "location of the database file")
|
|
fileStorePath = flag.String("file-store", "", "path to the directory where uploaded files will be stored")
|
|
httpListen = flag.String("listen", "127.0.0.1:8000", "listen address (host:port)")
|
|
metricsListen = flag.String("metrics_listen", "127.0.0.1:58614", "listen address for metrics (host:port)")
|
|
)
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
|
|
database, err := db.OpenDB(*databasePath)
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
defer database.Close()
|
|
filestore, err := db.OpenFileStore(*fileStorePath)
|
|
if err != nil {
|
|
log.Fatalln(err)
|
|
}
|
|
|
|
go rushlink.StartMetricsServer(*metricsListen, database)
|
|
rushlink.StartMainServer(*httpListen, database, filestore)
|
|
}
|