Skip to content

Commit

Permalink
Consistent use of 'default_channel' across all modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Breidenstein committed Jul 27, 2020
1 parent 5985fd9 commit 76e7433
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cpthook.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ modules:
gitlab:
endpoint: "/gitlab"
type: "gitlab"
default: "#defaultChannel"
default_channel: "#defaultChannel"
commit_limit: 3
groups:
"myGitlabGroup":
Expand All @@ -50,7 +50,7 @@ modules:
icinga2:
endpoint: "/betterthannagios"
type: "icinga"
default: "#monitoring"
default_channel: "#monitoring"
hostgroups:
"webservers":
- "#monitoring-web"
Expand Down
4 changes: 2 additions & 2 deletions input/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type GitlabModule struct {
}

type mapping struct {
DefaultChannel string `mapstructure:"default"`
DefaultChannel string `mapstructure:"default_channel"`
GroupMappings map[string][]string `mapstructure:"groups"`
ExplicitMappings map[string][]string `mapstructure:"explicit"`
}
Expand Down Expand Up @@ -53,7 +53,7 @@ func prefixContains(mapping map[string][]string, entry string) []string {
}

func (m *GitlabModule) Init(c *viper.Viper, channel *chan IRCMessage) {
err := c.UnmarshalKey("default", &m.channelMapping.DefaultChannel)
err := c.UnmarshalKey("default_channel", &m.channelMapping.DefaultChannel)
if err != nil {
log.Fatal("Failed to unmarshal default-channelmapping into struct")
}
Expand Down
4 changes: 2 additions & 2 deletions input/icinga2.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ type Icinga2Module struct {
}

type hgmapping struct {
DefaultChannel string `mapstructure:"default"`
DefaultChannel string `mapstructure:"default_channel"`
HostGroupMappings map[string][]string `mapstructure:"hostgroups"`
ExplicitMappings map[string][]string `mapstructure:"explicit"`
}

func (m *Icinga2Module) Init(c *viper.Viper, channel *chan IRCMessage) {
err := c.UnmarshalKey("default", &m.channelMapping.DefaultChannel)
err := c.UnmarshalKey("default_channel", &m.channelMapping.DefaultChannel)
if err != nil {
log.Panic(err)
}
Expand Down
4 changes: 2 additions & 2 deletions input/testconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ modules:
gitlab:
endpoint: "/gitlab"
type: "gitlab"
default: "#defaultChannel"
default_channel: "#defaultChannel"
commit_limit: 3
groups:
"myGitlabGroup":
Expand All @@ -24,7 +24,7 @@ modules:
icinga2:
endpoint: "/betterthannagios"
type: "icinga"
default: "#monitoring"
default_channel: "#monitoring"
hostgroups:
"webservers":
- "#monitoring-web"
Expand Down

0 comments on commit 76e7433

Please sign in to comment.