support env variables to overwrite toml file
This commit is contained in:
@@ -11,7 +11,7 @@ type MessageQueue interface {
|
||||
// GetName gets the name to locate the configuration in filer.toml file
|
||||
GetName() string
|
||||
// Initialize initializes the file store
|
||||
Initialize(configuration util.Configuration) error
|
||||
Initialize(configuration util.Configuration, prefix string) error
|
||||
SendMessage(key string, message proto.Message) error
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ var (
|
||||
Queue MessageQueue
|
||||
)
|
||||
|
||||
func LoadConfiguration(config *viper.Viper) {
|
||||
func LoadConfiguration(config *viper.Viper, prefix string) {
|
||||
|
||||
if config == nil {
|
||||
return
|
||||
@@ -30,9 +30,8 @@ func LoadConfiguration(config *viper.Viper) {
|
||||
validateOneEnabledQueue(config)
|
||||
|
||||
for _, queue := range MessageQueues {
|
||||
if config.GetBool(queue.GetName() + ".enabled") {
|
||||
viperSub := config.Sub(queue.GetName())
|
||||
if err := queue.Initialize(viperSub); err != nil {
|
||||
if config.GetBool(prefix + queue.GetName() + ".enabled") {
|
||||
if err := queue.Initialize(config, prefix+queue.GetName()+"."); err != nil {
|
||||
glog.Fatalf("Failed to initialize notification for %s: %+v",
|
||||
queue.GetName(), err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user