You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
703 B

6 years ago
  1. package filer2
  2. import (
  3. "os"
  4. "github.com/chrislusf/seaweedfs/weed/glog"
  5. "github.com/spf13/viper"
  6. )
  7. var (
  8. Stores []FilerStore
  9. )
  10. func (f *Filer) LoadConfiguration(config *viper.Viper) {
  11. for _, store := range Stores {
  12. if config.GetBool(store.GetName() + ".enabled") {
  13. viperSub := config.Sub(store.GetName())
  14. if err := store.Initialize(viperSub); err != nil {
  15. glog.Fatalf("Failed to initialize store for %s: %+v",
  16. store.GetName(), err)
  17. }
  18. f.SetStore(store)
  19. glog.V(0).Infof("Configure filer for %s", store.GetName())
  20. return
  21. }
  22. }
  23. println()
  24. println("Supported filer stores are:")
  25. for _, store := range Stores {
  26. println(" " + store.GetName())
  27. }
  28. os.Exit(-1)
  29. }