Skip to content

Commit 0264e6b

Browse files
authored
Merge pull request #137 from netlify/bugsnag_project_package
Add ProjectPackages to Bugsnag's configuration
2 parents f26b630 + 022b994 commit 0264e6b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

nconf/bugsnag.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,28 @@ import (
77
)
88

99
type BugSnagConfig struct {
10-
Environment string
11-
APIKey string `envconfig:"api_key"`
12-
LogHook bool `envconfig:"log_hook"`
10+
Environment string
11+
APIKey string `envconfig:"api_key"`
12+
LogHook bool `envconfig:"log_hook"`
13+
ProjectPackage string `envconfig:"project_package"`
1314
}
1415

1516
func SetupBugSnag(config *BugSnagConfig, version string) error {
1617
if config == nil || config.APIKey == "" {
1718
return nil
1819
}
20+
21+
projectPackages := make([]string, 0, 2)
22+
projectPackages = append(projectPackages, "main")
23+
if config.ProjectPackage != "" {
24+
projectPackages = append(projectPackages, config.ProjectPackage)
25+
}
1926

2027
bugsnag.Configure(bugsnag.Configuration{
2128
APIKey: config.APIKey,
2229
ReleaseStage: config.Environment,
2330
AppVersion: version,
31+
ProjectPackages: projectPackages,
2432
PanicHandler: func() {}, // this is to disable panic handling. The lib was forking and restarting the process (causing races)
2533
})
2634

0 commit comments

Comments
 (0)