fail early if two filer stores are defined

This commit is contained in:
Chris Lu 2018-12-06 00:32:36 -08:00
parent 52b24a9902
commit 63619f8b8e

View file

@ -13,6 +13,17 @@ var (
func (f *Filer) LoadConfiguration(config *viper.Viper) {
enabledStore := ""
for _, store := range Stores {
if config.GetBool(store.GetName() + ".enabled") {
if enabledStore == "" {
enabledStore = store.GetName()
} else {
glog.Fatalf("Filer store is enabled for both %s and %s", enabledStore, store.GetName())
}
}
}
for _, store := range Stores {
if config.GetBool(store.GetName() + ".enabled") {
viperSub := config.Sub(store.GetName())