mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-08-11 19:18:10 +00:00
Fix tests and make megacheck happy
This commit is contained in:
@@ -68,12 +68,8 @@ func (b *Bridge) joinChannels(channels map[string]config.ChannelInfo, exists map
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Bridge) ReloadConfig() {
|
||||
return
|
||||
}
|
||||
|
||||
func (b *Bridge) GetBool(key string) bool {
|
||||
if b.Config.GetBool(b.Account+"."+key) != false {
|
||||
if b.Config.GetBool(b.Account + "." + key) {
|
||||
return b.Config.GetBool(b.Account + "." + key)
|
||||
}
|
||||
return b.Config.GetBool("general." + key)
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spf13/viper"
|
||||
"os"
|
||||
@@ -192,6 +193,23 @@ func NewConfig(cfgfile string) *Config {
|
||||
return mycfg
|
||||
}
|
||||
|
||||
func NewConfigFromString(input []byte) *Config {
|
||||
var cfg ConfigValues
|
||||
viper.SetConfigType("toml")
|
||||
err := viper.ReadConfig(bytes.NewBuffer(input))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
err = viper.Unmarshal(&cfg)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
mycfg := new(Config)
|
||||
mycfg.v = viper.GetViper()
|
||||
mycfg.ConfigValues = &cfg
|
||||
return mycfg
|
||||
}
|
||||
|
||||
func (c *Config) GetBool(key string) bool {
|
||||
c.RLock()
|
||||
defer c.RUnlock()
|
||||
|
Reference in New Issue
Block a user