1
0
Fork 0
mirror of https://github.com/alice-lg/birdwatcher.git synced 2025-03-09 00:00:05 +01:00

added custom config, fix for #5

This commit is contained in:
hellerve 2017-02-22 18:49:17 +01:00
parent 3e8140a414
commit 9d15b64300
2 changed files with 11 additions and 5 deletions

View file

@ -98,16 +98,13 @@ func PrintServiceInfo(conf *Config, birdConf bird.BirdConfig) {
func main() {
bird6 := flag.Bool("6", false, "Use bird6 instead of bird")
configfile := flag.String("config", "./etc/ecix/birdwatcher.conf", "Configuration file location")
flag.Parse()
endpoints.VERSION = VERSION
bird.InstallRateLimitReset()
// Load configurations
conf, err := LoadConfigs([]string{
"./etc/ecix/birdwatcher.conf",
"/etc/ecix/birdwatcher.conf",
"./etc/ecix/birdwatcher.local.conf",
})
conf, err := LoadConfigs(ConfigOptions(*configfile))
if err != nil {
log.Fatal("Loading birdwatcher configuration failed:", err)

View file

@ -4,6 +4,7 @@ package main
import (
"fmt"
"strings"
"github.com/BurntSushi/toml"
"github.com/imdario/mergo"
@ -54,3 +55,11 @@ func LoadConfigs(configFiles []string) (*Config, error) {
return config, confError
}
func ConfigOptions(filename string) []string {
return []string{
strings.Join([]string{"/", filename}, ""),
filename,
strings.Replace(filename, ".conf", ".local.conf", 1),
}
}