2023-08-06 21:01:13 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-08-18 15:18:07 +00:00
|
|
|
"flag"
|
2023-08-24 19:21:52 +00:00
|
|
|
"fmt"
|
2023-08-06 21:01:13 +00:00
|
|
|
"net/http"
|
2023-08-24 19:21:52 +00:00
|
|
|
"os"
|
2023-08-06 21:01:13 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var BusClient *http.Client
|
2023-08-24 19:21:52 +00:00
|
|
|
var Quays []Quay
|
2023-08-06 21:01:13 +00:00
|
|
|
|
|
|
|
func main() {
|
2023-08-24 19:21:52 +00:00
|
|
|
var confFilename string
|
2023-08-18 15:18:07 +00:00
|
|
|
var port int
|
|
|
|
|
2023-08-24 19:21:52 +00:00
|
|
|
flag.StringVar(&confFilename, "c", "", "Path to the configuration file")
|
2023-08-18 15:18:07 +00:00
|
|
|
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
|
|
|
|
|
2023-08-06 21:01:13 +00:00
|
|
|
BusClient = &http.Client{}
|
2023-08-18 15:18:07 +00:00
|
|
|
serveHttp(port)
|
2023-08-06 21:01:13 +00:00
|
|
|
}
|