busdepartures/main.go

37 lines
638 B
Go
Raw Permalink Normal View History

package main
import (
"flag"
2023-08-24 19:21:52 +00:00
"fmt"
"net/http"
2023-08-24 19:21:52 +00:00
"os"
)
var BusClient *http.Client
2023-08-24 19:21:52 +00:00
var Quays []Quay
func main() {
2023-08-24 19:21:52 +00:00
var confFilename string
var port int
2023-08-24 19:21:52 +00:00
flag.StringVar(&confFilename, "c", "", "Path to the configuration file")
flag.IntVar(&port, "p", 4444, "The port to start the server on")
flag.Parse()
2023-08-24 19:21:52 +00:00
if confFilename == "" {
fmt.Printf("No configuation file provided. Provide the path to a configuration file with the -c flag.\n")
os.Exit(0)
}
conf, err := ReadConfigFromFile(confFilename)
if err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
}
Quays = conf.Quays
BusClient = &http.Client{}
serveHttp(port)
}