diff options
author | John Cai <jcai@gitlab.com> | 2019-10-31 20:55:55 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2019-10-31 20:55:55 +0300 |
commit | 4ac05973650542d9a9009466b1cf3a71272e1dda (patch) | |
tree | 8551f3f7ae5f8e1ab200c0793a04f39b67b6e84f /internal/praefect/config | |
parent | afb300947a641c9a2d4f09f987e3b74370286969 (diff) |
Adding sentry config to praefect
Refactored configs so that both praefect and gitaly can share logging
and sentry config structs
Diffstat (limited to 'internal/praefect/config')
-rw-r--r-- | internal/praefect/config/config.go | 12 | ||||
-rw-r--r-- | internal/praefect/config/config_test.go | 10 | ||||
-rw-r--r-- | internal/praefect/config/testdata/config.toml | 10 |
3 files changed, 23 insertions, 9 deletions
diff --git a/internal/praefect/config/config.go b/internal/praefect/config/config.go index 89e62a488..e400350fd 100644 --- a/internal/praefect/config/config.go +++ b/internal/praefect/config/config.go @@ -6,8 +6,9 @@ import ( "github.com/BurntSushi/toml" - "gitlab.com/gitlab-org/gitaly/internal/auth" - "gitlab.com/gitlab-org/gitaly/internal/config" + "gitlab.com/gitlab-org/gitaly/internal/config/auth" + "gitlab.com/gitlab-org/gitaly/internal/config/log" + "gitlab.com/gitlab-org/gitaly/internal/config/sentry" "gitlab.com/gitlab-org/gitaly/internal/praefect/models" ) @@ -19,9 +20,10 @@ type Config struct { Nodes []*models.Node `toml:"node"` - Logging config.Logging `toml:"logging"` - PrometheusListenAddr string `toml:"prometheus_listen_addr"` - Auth auth.Config `toml:"auth"` + Logging log.Config `toml:"logging"` + Sentry sentry.Config `toml:"sentry"` + PrometheusListenAddr string `toml:"prometheus_listen_addr"` + Auth auth.Config `toml:"auth"` } // FromFile loads the config for the passed file path diff --git a/internal/praefect/config/config_test.go b/internal/praefect/config/config_test.go index 658effa7e..bf707d5d7 100644 --- a/internal/praefect/config/config_test.go +++ b/internal/praefect/config/config_test.go @@ -5,6 +5,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "gitlab.com/gitlab-org/gitaly/internal/config/log" + "gitlab.com/gitlab-org/gitaly/internal/config/sentry" "gitlab.com/gitlab-org/gitaly/internal/praefect/models" ) @@ -74,6 +76,14 @@ func TestConfigParsing(t *testing.T) { filePath: "testdata/config.toml", expected: Config{ VirtualStorageName: "praefect", + Logging: log.Config{ + Level: "info", + Format: "json", + }, + Sentry: sentry.Config{ + DSN: "abcd123", + Environment: "production", + }, Nodes: []*models.Node{ &models.Node{ Address: "tcp://gitaly-internal-1.example.com", diff --git a/internal/praefect/config/testdata/config.toml b/internal/praefect/config/testdata/config.toml index c7f920e90..1c85c7e47 100644 --- a/internal/praefect/config/testdata/config.toml +++ b/internal/praefect/config/testdata/config.toml @@ -4,10 +4,12 @@ socket_path = "" prometheus_listen_addr = "" [logging] - format = "" - sentry_dsn = "" - ruby_sentry_dsn = "" - level = "" + format = "json" + level = "info" + +[sentry] + sentry_environment = "production" + sentry_dsn = "abcd123" [[node]] address = "tcp://gitaly-internal-1.example.com" |