busdepartures/main.go

37 lines
638 B
Go

package main
import (
"flag"
"fmt"
"net/http"
"os"
)
var BusClient *http.Client
var Quays []Quay
func main() {
var confFilename string
var port int
flag.StringVar(&confFilename, "c", "", "Path to the configuration file")
flag.IntVar(&port, "p", 4444, "The port to start the server on")
flag.Parse()
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)
}