-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove autoconfig testapp, use real env variables
- Loading branch information
1 parent
d5b1184
commit 8507abc
Showing
29 changed files
with
180 additions
and
344 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
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,39 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
bugsnag "github.com/bugsnag/bugsnag-go/v2" | ||
) | ||
|
||
func AutoconfigPanicScenario(command Command) (bugsnag.Configuration, func()) { | ||
config := ConfigureBugsnag(command) | ||
|
||
scenarioFunc := func() { | ||
panic("PANIQ!") | ||
} | ||
return config, scenarioFunc | ||
} | ||
|
||
func AutoconfigHandledScenario(command Command) (bugsnag.Configuration, func()) { | ||
config := ConfigureBugsnag(command) | ||
|
||
scenarioFunc := func() { | ||
bugsnag.Notify(fmt.Errorf("gone awry!")) | ||
} | ||
return config, scenarioFunc | ||
} | ||
|
||
func AutoconfigMetadataScenario(command Command) (bugsnag.Configuration, func()) { | ||
config := ConfigureBugsnag(command) | ||
|
||
scenarioFunc := func() { | ||
bugsnag.OnBeforeNotify(func(event *bugsnag.Event, config *bugsnag.Configuration) error { | ||
event.MetaData.Add("fruit", "Tomato", "beefsteak") | ||
event.MetaData.Add("snacks", "Carrot", "4") | ||
return nil | ||
}) | ||
bugsnag.Notify(fmt.Errorf("gone awry!")) | ||
} | ||
return config, scenarioFunc | ||
} |
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 |
---|---|---|
@@ -1,47 +1,15 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"strconv" | ||
"strings" | ||
|
||
bugsnag "github.com/bugsnag/bugsnag-go/v2" | ||
) | ||
|
||
func ConfigureBugsnag() bugsnag.Configuration { | ||
config := bugsnag.Configuration{ | ||
APIKey: os.Getenv("API_KEY"), | ||
AppVersion: os.Getenv("APP_VERSION"), | ||
AppType: os.Getenv("APP_TYPE"), | ||
Hostname: os.Getenv("HOSTNAME"), | ||
} | ||
|
||
if notifyReleaseStages := os.Getenv("NOTIFY_RELEASE_STAGES"); notifyReleaseStages != "" { | ||
config.NotifyReleaseStages = strings.Split(notifyReleaseStages, ",") | ||
} | ||
|
||
if releaseStage := os.Getenv("RELEASE_STAGE"); releaseStage != "" { | ||
config.ReleaseStage = releaseStage | ||
} | ||
|
||
if filters := os.Getenv("PARAMS_FILTERS"); filters != "" { | ||
config.ParamsFilters = []string{filters} | ||
} | ||
|
||
sync, err := strconv.ParseBool(os.Getenv("SYNCHRONOUS")) | ||
if err == nil { | ||
config.Synchronous = sync | ||
} | ||
func ConfigureBugsnag(command Command) bugsnag.Configuration { | ||
config := bugsnag.Configuration{} | ||
|
||
acs, err := strconv.ParseBool(os.Getenv("AUTO_CAPTURE_SESSIONS")) | ||
if err == nil { | ||
config.AutoCaptureSessions = acs | ||
} | ||
config.APIKey = command.APIKey | ||
config.Endpoints.Sessions = command.SessionsEndpoint | ||
config.Endpoints.Notify = command.NotifyEndpoint | ||
|
||
config.Endpoints = bugsnag.Endpoints{ | ||
Notify: os.Getenv("BUGSNAG_NOTIFY_ENDPOINT"), | ||
Sessions: os.Getenv("BUGSNAG_SESSIONS_ENDPOINT"), | ||
} | ||
|
||
return config | ||
} |
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
Oops, something went wrong.