2017-09-17 03:26:19 +02:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/FreifunkBremen/yanic/database"
|
|
|
|
"github.com/FreifunkBremen/yanic/respond"
|
|
|
|
"github.com/FreifunkBremen/yanic/runtime"
|
2018-01-07 21:00:56 +01:00
|
|
|
"github.com/FreifunkBremen/yanic/runtime/config"
|
2017-09-17 03:26:19 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
configPath string
|
|
|
|
collector *respond.Collector
|
|
|
|
connections database.Connection
|
|
|
|
nodes *runtime.Nodes
|
|
|
|
)
|
|
|
|
|
2018-01-07 21:00:56 +01:00
|
|
|
func loadConfig() *config.Config {
|
|
|
|
config, err := config.ReadConfigFile(configPath)
|
2017-09-17 03:26:19 +02:00
|
|
|
if err != nil {
|
|
|
|
fmt.Fprintln(os.Stderr, "unable to load config file:", err)
|
|
|
|
os.Exit(2)
|
|
|
|
}
|
|
|
|
return config
|
|
|
|
}
|