updated initialization
This commit is contained in:
parent
5471f57dd4
commit
608f998d0a
@ -4,7 +4,7 @@ import (
|
||||
"flag"
|
||||
"log"
|
||||
|
||||
"github.com/alice-lg/alice-lg/pkg/backend"
|
||||
"github.com/alice-lg/alice-lg/pkg/store"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -19,31 +19,29 @@ func main() {
|
||||
flag.Parse()
|
||||
|
||||
// Load configuration
|
||||
if err := backend.InitConfig(*configFilenameFlag); err != nil {
|
||||
cfg, err = config.LoadConfig(filename)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// Say hi
|
||||
printBanner()
|
||||
|
||||
log.Println("Using configuration:", backend.AliceConfig.File)
|
||||
log.Println("Using configuration:", cfg.File)
|
||||
|
||||
// Setup local routes store
|
||||
backend.InitStores()
|
||||
neighborsStore := store.NewNeighborsStore(cfg)
|
||||
routesStore := store.NewRoutesStore(cfg)
|
||||
|
||||
// Start stores
|
||||
if backend.AliceConfig.Server.EnablePrefixLookup == true {
|
||||
go backend.AliceRoutesStore.Start()
|
||||
}
|
||||
|
||||
// Setup local neighbours store
|
||||
if backend.AliceConfig.Server.EnablePrefixLookup == true {
|
||||
go backend.AliceNeighboursStore.Start()
|
||||
go neighborsStore.Start()
|
||||
go routesStore.Start()
|
||||
}
|
||||
|
||||
// Start the Housekeeping
|
||||
go backend.Housekeeping(backend.AliceConfig)
|
||||
go store.Housekeeping(cfg)
|
||||
|
||||
// Start HTTP API
|
||||
go backend.StartHTTPServer()
|
||||
|
||||
<-quit
|
||||
|
@ -787,14 +787,8 @@ func getSources(config *ini.File) ([]*SourceConfig, error) {
|
||||
return sources, nil
|
||||
}
|
||||
|
||||
// Try to load configfiles as specified in the files
|
||||
// list. For example:
|
||||
//
|
||||
// ./etc/alice-lg/alice.conf
|
||||
// /etc/alice-lg/alice.conf
|
||||
// ./etc/alice-lg/alice.local.conf
|
||||
//
|
||||
func loadConfig(file string) (*Config, error) {
|
||||
// Try to load the config file
|
||||
func LoadConfig(file string) (*Config, error) {
|
||||
|
||||
// Try to get config file, fallback to alternatives
|
||||
file, err := getConfigFile(file)
|
||||
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package store
|
||||
|
||||
import (
|
||||
"log"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package store
|
||||
|
||||
import (
|
||||
"sort"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package routes
|
||||
|
||||
import (
|
||||
"log"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package store
|
||||
|
||||
import (
|
||||
"log"
|
@ -1,4 +1,6 @@
|
||||
package backend
|
||||
// Package store provides a store for persisting and
|
||||
// querying neighbors and routes.
|
||||
package store
|
||||
|
||||
import (
|
||||
"time"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package store
|
||||
|
||||
import (
|
||||
"log"
|
Loading…
x
Reference in New Issue
Block a user