Skip to content

Commit

Permalink
Rename opsgenie config api_host to api_url
Browse files Browse the repository at this point in the history
  • Loading branch information
josedonizetti committed Nov 8, 2017
1 parent 2a058aa commit d39f8b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,14 @@ func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error {
}
}
for _, ogc := range rcv.OpsGenieConfigs {
if ogc.APIHost == "" {
if ogc.APIURL == "" {
if c.Global.OpsGenieAPIURL == "" {
return fmt.Errorf("no global OpsGenie API URL set")
}
ogc.APIHost = c.Global.OpsGenieAPIURL
ogc.APIURL = c.Global.OpsGenieAPIURL
}
if !strings.HasSuffix(ogc.APIHost, "/") {
ogc.APIHost += "/"
if !strings.HasSuffix(ogc.APIURL, "/") {
ogc.APIURL += "/"
}
}
for _, voc := range rcv.VictorOpsConfigs {
Expand Down
2 changes: 1 addition & 1 deletion config/notifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ type OpsGenieConfig struct {
NotifierConfig `yaml:",inline" json:",inline"`

APIKey Secret `yaml:"api_key,omitempty" json:"api_key,omitempty"`
APIHost string `yaml:"api_host,omitempty" json:"api_host,omitempty"`
APIURL string `yaml:"api_url,omitempty" json:"api_url,omitempty"`
Message string `yaml:"message,omitempty" json:"message,omitempty"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Source string `yaml:"source,omitempty" json:"source,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions notify/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ func (n *OpsGenie) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
)
switch alerts.Status() {
case model.AlertResolved:
apiURL = fmt.Sprintf("%sv2/alerts/%s/close?identifierType=alias", n.conf.APIHost, alias)
apiURL = fmt.Sprintf("%sv2/alerts/%s/close?identifierType=alias", n.conf.APIURL, alias)
msg = &opsGenieCloseMessage{Source: tmpl(n.conf.Source)}
default:
message := tmpl(n.conf.Message)
Expand All @@ -834,7 +834,7 @@ func (n *OpsGenie) Notify(ctx context.Context, as ...*types.Alert) (bool, error)
level.Debug(n.logger).Log("msg", "Truncated message to %q due to OpsGenie message limit", "truncated_message", message, "incident", key)
}

apiURL = n.conf.APIHost + "v2/alerts"
apiURL = n.conf.APIURL + "v2/alerts"
msg = &opsGenieCreateMessage{
Alias: alias,
Message: message,
Expand Down

0 comments on commit d39f8b1

Please sign in to comment.