Closed valentin-krasontovitsch closed 6 years ago
I've done it like that:
// Get the config from the environment
dsn := os.Getenv("SENTRY_DSN")
projectID := os.Getenv("SENTRY_PROJECT")
// Build the url
uri := fmt.Sprintf("https://%s@sentry.io/%s", dsn, projectID)
// Init sentry
raven.SetDSN(uri)
Okay, I've actually tried to understand and use the automagic configuration one more time, and it turns out there's literally nothing that you have to do when you set the SENTRY_DSN
variable to a valid sentry dsn - in your code, you can just start capturing using raven.CaptureError
(or whatever you wanna use), which is gonna call the default client internally, which gets configured automatically, reading the environment variable... cool ^^
I must have made a mistake in my earlier trials, so I'm gonna go ahead and close this issue.
The Configuring the client section of the Usage and Examples mentions that the DSN can be picked up automagically from an environment variable
SENTRY_DSN
- yet using the provided examples and leaving out the call toraven.setDNS
does (surprisingly to me ^^) not yield a functioning client.Maybe I expect to much automagic, but in any case I think there should be an example where a sentry client is invoked without specifying the DSN explicitely.
In that context it should at least be mentioned that sentry doesn't care if the dsn is empty, and that it's the user's responsibility to check for that, cf. #85