-
-
Notifications
You must be signed in to change notification settings - Fork 801
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WTF-400 PagerDuty extracted to new config format
- Loading branch information
Chris Cummer
committed
Apr 16, 2019
1 parent
265149c
commit a8e9f69
Showing
4 changed files
with
49 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package pagerduty | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/olebedev/config" | ||
"github.com/wtfutil/wtf/cfg" | ||
) | ||
|
||
type Settings struct { | ||
common *cfg.Common | ||
|
||
apiKey string | ||
escalationFilter []interface{} | ||
showIncidents bool | ||
showSchedules bool | ||
} | ||
|
||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings { | ||
localConfig, _ := ymlConfig.Get("wtf.mods.pagerduty") | ||
|
||
settings := Settings{ | ||
common: cfg.NewCommonSettingsFromYAML(ymlConfig), | ||
|
||
apiKey: localConfig.UString("apiKey", os.Getenv("WTF_PAGERDUTY_API_KEY")), | ||
escalationFilter: localConfig.UList("escalationFilter"), | ||
showIncidents: localConfig.UBool("showIncidents", true), | ||
showSchedules: localConfig.UBool("showSchedules", true), | ||
} | ||
|
||
return &settings | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters