forked from electricdusk/rushlink
		
	
		
			
				
	
	
		
			35 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			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)")
 | |
| 	rootURL       = flag.String("root_url", "", "host root (example: 'https://example.com', uses an educated guess if omitted)")
 | |
| )
 | |
| 
 | |
| func main() {
 | |
| 	flag.Parse()
 | |
| 
 | |
| 	filestore, err := db.OpenFileStore(*fileStorePath)
 | |
| 	if err != nil {
 | |
| 		log.Fatalln(err)
 | |
| 	}
 | |
| 	database, err := db.OpenDB(*databasePath, filestore)
 | |
| 	if err != nil {
 | |
| 		log.Fatalln(err)
 | |
| 	}
 | |
| 	defer database.Close()
 | |
| 
 | |
| 	go rushlink.StartMetricsServer(*metricsListen, database, filestore)
 | |
| 	rushlink.StartMainServer(*httpListen, database, filestore, *rootURL)
 | |
| }
 |