summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsh McKenzie <amckenzie@gitlab.com>2020-07-01 19:55:22 +1000
committerAsh McKenzie <amckenzie@gitlab.com>2020-07-01 20:00:36 +1000
commit5d8d00fb7139612cbab9a3c1b0187816302d7d4a (patch)
tree20af3df0b4ae75d90c5498acf88de9f79d99aeb7
parent86e99068e0679755f5ecfa26d463addc2b4c1648 (diff)
downloadgitlab-shell-5d8d00fb7139612cbab9a3c1b0187816302d7d4a.tar.gz
Support new ssl_cert_dir config setting
-rw-r--r--config.yml.example4
-rw-r--r--internal/config/config.go1
-rw-r--r--internal/config/config_test.go9
3 files changed, 14 insertions, 0 deletions
diff --git a/config.yml.example b/config.yml.example
index c2c1027..60435a3 100644
--- a/config.yml.example
+++ b/config.yml.example
@@ -27,6 +27,10 @@ http_settings:
# File used as authorized_keys for gitlab user
auth_file: "/home/git/.ssh/authorized_keys"
+# SSL certificate dir where custom certificates can be placed
+# https://golang.org/pkg/crypto/x509/
+# ssl_cert_dir: /opt/gitlab/embedded/ssl/certs/
+
# File that contains the secret key for verifying access to GitLab.
# Default is .gitlab_shell_secret in the gitlab-shell directory.
# secret_file: "/home/git/gitlab-shell/.gitlab_shell_secret"
diff --git a/internal/config/config.go b/internal/config/config.go
index deed74d..be9efa3 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -34,6 +34,7 @@ type Config struct {
GitlabTracing string `yaml:"gitlab_tracing"`
SecretFilePath string `yaml:"secret_file"`
Secret string `yaml:"secret"`
+ SslCertDir string `yaml:"ssl_cert_dir"`
HttpSettings HttpSettingsConfig `yaml:"http_settings"`
HttpClient *client.HttpClient
}
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index 202db6d..77351f2 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -29,6 +29,7 @@ func TestParseConfig(t *testing.T) {
format string
gitlabUrl string
secret string
+ sslCertDir string
httpSettings HttpSettingsConfig
}{
{
@@ -80,6 +81,13 @@ func TestParseConfig(t *testing.T) {
secret: "an inline secret",
},
{
+ yaml: "ssl_cert_dir: /tmp/certs",
+ path: path.Join(testRoot, "gitlab-shell.log"),
+ format: "text",
+ secret: "default-secret-content",
+ sslCertDir: "/tmp/certs",
+ },
+ {
yaml: "http_settings:\n user: user_basic_auth\n password: password_basic_auth\n read_timeout: 500",
path: path.Join(testRoot, "gitlab-shell.log"),
format: "text",
@@ -106,6 +114,7 @@ func TestParseConfig(t *testing.T) {
assert.Equal(t, tc.format, cfg.LogFormat)
assert.Equal(t, tc.gitlabUrl, cfg.GitlabUrl)
assert.Equal(t, tc.secret, cfg.Secret)
+ assert.Equal(t, tc.sslCertDir, cfg.SslCertDir)
assert.Equal(t, tc.httpSettings, cfg.HttpSettings)
})
}