diff options
author | Toon Claes <toon@gitlab.com> | 2021-06-21 10:28:21 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2021-06-21 10:28:21 +0300 |
commit | 906ba37cd3a5fef796d1b3baceff55d153c355ec (patch) | |
tree | 6ed967f81ce70fbcba235c730cff38fd1fdeef50 | |
parent | 63269053b301be3641a240545163e2df81b601f5 (diff) | |
parent | a5086f2d1309f060c358b08f5fc43a5fe491017e (diff) |
Merge branch 'ps-rm-env-config' into 'master'
Remove deprecated env config values
See merge request gitlab-org/gitaly!3604
-rw-r--r-- | doc/configuration/README.md | 41 | ||||
-rw-r--r-- | internal/gitaly/config/config.go | 5 | ||||
-rw-r--r-- | internal/gitaly/config/config_test.go | 44 |
3 files changed, 0 insertions, 90 deletions
diff --git a/doc/configuration/README.md b/doc/configuration/README.md index 936477ce5..834748874 100644 --- a/doc/configuration/README.md +++ b/doc/configuration/README.md @@ -182,44 +182,3 @@ level = "warn" |sentry_dsn|string|no|Sentry DSN for exception monitoring| |sentry_environment|string|no|Sentry Environment for exception monitoring| |ruby_sentry_dsn|string|no|Sentry DSN for gitaly-ruby exception monitoring| - -## Environment variables - -### GITALY_SOCKET_PATH - -Required unless GITALY_LISTEN_ADDR is set. Overrides `socket_path` in -config.toml. Deprecated; use config.toml. - -A path at which Gitaly should open a Unix socket. Example value: - -``` -GITALY_SOCKET_PATH=/home/git/gitlab/tmp/sockets/private/gitaly.socket -``` - -### GITALY_LISTEN_ADDR - -Required unless GITALY_SOCKET_PATH is set. Overrides `listen_addr` in -config.toml. Deprecated; use config.toml. - -TCP address for Gitaly to listen on. Note: at the moment Gitaly does -not offer any form of authentication. When you use a TCP listener you -must use firewalls or other network-based security to restrict access -to Gitaly. - -Example value: - -``` -GITALY_LISTEN_ADDR=localhost:1234 -``` - -### GITALY_PROMETHEUS_LISTEN_ADDR - -Optional. Overrides `prometheus_listen_addr` in config.toml. -Deprecated; use config.toml. - -TCP listen address for Prometheus metrics. When missing or empty, no -Prometheus listener is started. - -``` -GITALY_PROMETHEUS_LISTEN_ADDR=localhost:9236 -``` diff --git a/internal/gitaly/config/config.go b/internal/gitaly/config/config.go index 77802a546..6c0ef1991 100644 --- a/internal/gitaly/config/config.go +++ b/internal/gitaly/config/config.go @@ -13,7 +13,6 @@ import ( "strings" "time" - "github.com/kelseyhightower/envconfig" "github.com/pelletier/go-toml" log "github.com/sirupsen/logrus" "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/config/auth" @@ -157,10 +156,6 @@ func Load(file io.Reader) (Cfg, error) { return Cfg{}, fmt.Errorf("load toml: %v", err) } - if err := envconfig.Process("gitaly", &cfg); err != nil { - return Cfg{}, fmt.Errorf("envconfig: %v", err) - } - if err := cfg.setDefaults(); err != nil { return Cfg{}, err } diff --git a/internal/gitaly/config/config_test.go b/internal/gitaly/config/config_test.go index bb78aa7f0..9910feffd 100644 --- a/internal/gitaly/config/config_test.go +++ b/internal/gitaly/config/config_test.go @@ -166,50 +166,6 @@ func TestLoadListenAddr(t *testing.T) { assert.Equal(t, ":8080", cfg.ListenAddr) } -func tempEnv(t *testing.T, key, value string) func() { - temp := os.Getenv(key) - require.NoError(t, os.Setenv(key, value)) - - return func() { - require.NoError(t, os.Setenv(key, temp)) - } -} - -func TestLoadOverrideEnvironment(t *testing.T) { - // Test that this works since we still want this to work - tempEnv1 := tempEnv(t, "GITALY_SOCKET_PATH", "/tmp/gitaly2.sock") - defer tempEnv1() - tempEnv2 := tempEnv(t, "GITALY_LISTEN_ADDR", ":8081") - defer tempEnv2() - tempEnv3 := tempEnv(t, "GITALY_PROMETHEUS_LISTEN_ADDR", ":9237") - defer tempEnv3() - - tmpFile := strings.NewReader(`socket_path = "/tmp/gitaly.sock" -listen_addr = ":8080" -prometheus_listen_addr = ":9236"`) - - cfg, err := Load(tmpFile) - require.NoError(t, err) - - assert.Equal(t, ":9237", cfg.PrometheusListenAddr) - assert.Equal(t, "/tmp/gitaly2.sock", cfg.SocketPath) - assert.Equal(t, ":8081", cfg.ListenAddr) -} - -func TestLoadOnlyEnvironment(t *testing.T) { - // Test that this works since we still want this to work - defer tempEnv(t, "GITALY_SOCKET_PATH", "/tmp/gitaly2.sock")() - defer tempEnv(t, "GITALY_LISTEN_ADDR", ":8081")() - defer tempEnv(t, "GITALY_PROMETHEUS_LISTEN_ADDR", ":9237")() - - cfg, err := Load(&bytes.Buffer{}) - require.NoError(t, err) - - assert.Equal(t, ":9237", cfg.PrometheusListenAddr) - assert.Equal(t, "/tmp/gitaly2.sock", cfg.SocketPath) - assert.Equal(t, ":8081", cfg.ListenAddr) -} - func TestValidateStorages(t *testing.T) { repositories, err := filepath.Abs("testdata/repositories") require.NoError(t, err) |