README.md 874 Bytes
Newer Older
Kirill Garbar's avatar
Kirill Garbar committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Environment Variables

## Sentry config

### `SENTRY_DSN`

Sentry DNS

### `ENV`

Current system environment. Supported options are:

* `DEV`
* `STG`
* `PROD`

### `RELEASE`

Current release version of backend. Can be set in CI/CD using:

```bash
sed -i app.yaml -e "s/__RELEASE__/$CI_COMMIT_TAG/"
```

### Usage

Current release version of backend. Can be set in CI/CD using:

```go
package main

import (
    "github.com/labstack/echo/v4"
    "yn.ee/facktoreal/sentry"
)

func main()  {
    e := echo.New()

    if err := sentry.Init(); err != nil {
        // handle error
    }

    // Activate echo middleware
    e.Use(sentry.Middleware())
}

func init() {
    if err = srv.Update(data); err != nil {
    	sentry.CaptureErrorAndWait(err, map[string]string{"category": "db"})

        return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
    }
}
```