aboutsummaryrefslogtreecommitdiff
path: root/weed/filer2/configuration.go
blob: 80755ee5e95b76ba1034e79973d6fd85a0d0703d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package filer2

import (
	"os"

	"github.com/chrislusf/seaweedfs/weed/glog"
	"github.com/spf13/viper"
)


var (
	Stores []FilerStore
)

func (f *Filer) LoadConfiguration(config *viper.Viper) {

	for _, store := range Stores {
		if config.GetBool(store.GetName() + ".enabled") {
			viperSub := config.Sub(store.GetName())
			if err := store.Initialize(viperSub); err != nil {
				glog.Fatalf("Failed to initialize store for %s: %+v",
					store.GetName(), err)
			}
			f.SetStore(store)
			glog.V(0).Infof("Configure filer for %s", store.GetName())
			return
		}
	}

	println()
	println("Supported filer stores are:")
	for _, store := range Stores {
		println("    " + store.GetName())
	}

	os.Exit(-1)
}