1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00

49 lines
846 B
Go
Raw Normal View History

2017-05-16 13:39:59 +02:00
package main
2017-05-16 15:22:40 +02:00
import (
2017-05-19 16:16:14 +02:00
"flag"
2017-05-16 15:22:40 +02:00
"log"
2017-05-16 13:39:59 +02:00
2021-10-20 18:36:30 +00:00
"github.com/alice-lg/alice-lg/pkg/store"
2021-03-22 16:25:47 +01:00
)
2017-05-18 15:23:36 +02:00
2017-05-16 13:39:59 +02:00
func main() {
2021-03-22 17:35:20 +01:00
quit := make(chan bool)
2017-05-19 16:16:14 +02:00
// Handle commandline parameters
configFilenameFlag := flag.String(
"config", "/etc/alice-lg/alice.conf",
2017-05-19 16:16:14 +02:00
"Alice looking glass configuration file",
)
flag.Parse()
2017-05-16 15:22:40 +02:00
// Load configuration
2021-10-20 18:36:30 +00:00
cfg, err = config.LoadConfig(filename)
if err != nil {
2017-05-19 16:16:14 +02:00
log.Fatal(err)
}
// Say hi
printBanner()
2021-10-20 18:36:30 +00:00
log.Println("Using configuration:", cfg.File)
2017-05-16 15:22:40 +02:00
2017-06-23 12:36:32 +02:00
// Setup local routes store
2021-10-20 18:36:30 +00:00
neighborsStore := store.NewNeighborsStore(cfg)
routesStore := store.NewRoutesStore(cfg)
2017-07-04 12:36:48 +02:00
2021-03-22 17:35:20 +01:00
// Start stores
if backend.AliceConfig.Server.EnablePrefixLookup == true {
2021-10-20 18:36:30 +00:00
go neighborsStore.Start()
go routesStore.Start()
2017-07-04 12:36:48 +02:00
}
2017-06-23 17:40:19 +02:00
// Start the Housekeeping
2021-10-20 18:36:30 +00:00
go store.Housekeeping(cfg)
2017-05-16 15:22:40 +02:00
2021-10-20 18:36:30 +00:00
// Start HTTP API
2021-03-22 17:35:20 +01:00
go backend.StartHTTPServer()
2017-05-18 14:44:50 +02:00
2021-03-22 17:35:20 +01:00
<-quit
2017-05-16 13:39:59 +02:00
}