summaryrefslogtreecommitdiffstats
path: root/bridge/config/config.go
diff options
context:
space:
mode:
authorQais Patankar <qaisjp@gmail.com>2020-06-24 23:25:10 +0100
committerGitHub <noreply@github.com>2020-06-25 00:25:10 +0200
commita41accd033a8d7e859a4bff89ae64e1f3500e4d2 (patch)
treee7b86f05c725632b2e285ac1ee42f669819dfc32 /bridge/config/config.go
parent37f7caf7f398bfab7acffe3e0dda443ed2ca041d (diff)
downloadmatterbridge-msglm-a41accd033a8d7e859a4bff89ae64e1f3500e4d2.tar.gz
matterbridge-msglm-a41accd033a8d7e859a4bff89ae64e1f3500e4d2.tar.bz2
matterbridge-msglm-a41accd033a8d7e859a4bff89ae64e1f3500e4d2.zip
Add sane RemoteNickFormat default for API (#1157)
Diffstat (limited to 'bridge/config/config.go')
-rw-r--r--bridge/config/config.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/bridge/config/config.go b/bridge/config/config.go
index 59d7d4be..d98c9423 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -219,6 +219,7 @@ type BridgeValues struct {
type Config interface {
Viper() *viper.Viper
BridgeValues() *BridgeValues
+ IsKeySet(key string) bool
GetBool(key string) (bool, bool)
GetInt(key string) (int, bool)
GetString(key string) (string, bool)
@@ -303,6 +304,12 @@ func (c *config) Viper() *viper.Viper {
return c.v
}
+func (c *config) IsKeySet(key string) bool {
+ c.RLock()
+ defer c.RUnlock()
+ return c.v.IsSet(key)
+}
+
func (c *config) GetBool(key string) (bool, bool) {
c.RLock()
defer c.RUnlock()
@@ -362,6 +369,11 @@ type TestConfig struct {
Overrides map[string]interface{}
}
+func (c *TestConfig) IsKeySet(key string) bool {
+ _, ok := c.Overrides[key]
+ return ok || c.Config.IsKeySet(key)
+}
+
func (c *TestConfig) GetBool(key string) (bool, bool) {
val, ok := c.Overrides[key]
if ok {