Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Wiedler <iwiedler@gitlab.com>2020-04-30 18:41:24 +0300
committerIgor Wiedler <iwiedler@gitlab.com>2020-04-30 18:41:24 +0300
commit76dc097b972fb9415b37b04b44cb54ca91811cb6 (patch)
tree38bf92a3e222df8cdce274785ab3e754a7a801b2
parent22cadaef88074326535e49fb0dc2d345619408da (diff)
change back to internal-gitlab-server as per @@vshushlin
-rw-r--r--app_config.go8
-rw-r--r--internal/source/domains.go2
-rw-r--r--internal/source/domains_test.go2
-rw-r--r--internal/source/gitlab/client/client.go4
-rw-r--r--internal/source/gitlab/client/config.go2
-rw-r--r--main.go12
6 files changed, 15 insertions, 15 deletions
diff --git a/app_config.go b/app_config.go
index cbaed36f..5d481bb6 100644
--- a/app_config.go
+++ b/app_config.go
@@ -29,7 +29,7 @@ type appConfig struct {
StoreSecret string
GitLabServer string
- GitLabAPIServer string
+ InternalGitLabServer string
GitLabAPISecretKey []byte
GitlabClientHTTPTimeout time.Duration
GitlabJWTTokenExpiration time.Duration
@@ -41,9 +41,9 @@ type appConfig struct {
CustomHeaders []string
}
-// GitlabAPIServerURL returns URL to a GitLab instance.
-func (config appConfig) GitlabAPIServerURL() string {
- return config.GitLabAPIServer
+// InternalGitLabServerURL returns URL to a GitLab instance.
+func (config appConfig) InternalGitLabServerURL() string {
+ return config.InternalGitLabServer
}
// GitlabClientSecret returns GitLab server access token.
diff --git a/internal/source/domains.go b/internal/source/domains.go
index 35dc2e78..8de7c574 100644
--- a/internal/source/domains.go
+++ b/internal/source/domains.go
@@ -41,7 +41,7 @@ type Domains struct {
// not initialize `dm` as we later check the readiness by comparing it with a
// nil value.
func NewDomains(config Config) (*Domains, error) {
- if len(config.GitlabAPIServerURL()) == 0 || len(config.GitlabAPISecret()) == 0 {
+ if len(config.InternalGitLabServerURL()) == 0 || len(config.GitlabAPISecret()) == 0 {
return &Domains{disk: disk.New()}, nil
}
diff --git a/internal/source/domains_test.go b/internal/source/domains_test.go
index 68ea5cec..ebafb6fc 100644
--- a/internal/source/domains_test.go
+++ b/internal/source/domains_test.go
@@ -16,7 +16,7 @@ type sourceConfig struct {
secret string
}
-func (c sourceConfig) GitlabAPIServerURL() string {
+func (c sourceConfig) InternalGitLabServerURL() string {
return c.api
}
diff --git a/internal/source/gitlab/client/client.go b/internal/source/gitlab/client/client.go
index 8019f457..bfe425b9 100644
--- a/internal/source/gitlab/client/client.go
+++ b/internal/source/gitlab/client/client.go
@@ -27,7 +27,7 @@ type Client struct {
}
// NewClient initializes and returns new Client baseUrl is
-// appConfig.GitLabAPIServer secretKey is appConfig.GitLabAPISecretKey
+// appConfig.InternalGitLabServer secretKey is appConfig.GitLabAPISecretKey
func NewClient(baseURL string, secretKey []byte, connectionTimeout, jwtTokenExpiry time.Duration) (*Client, error) {
if len(baseURL) == 0 || len(secretKey) == 0 {
return nil, errors.New("GitLab API URL or API secret has not been provided")
@@ -59,7 +59,7 @@ func NewClient(baseURL string, secretKey []byte, connectionTimeout, jwtTokenExpi
// NewFromConfig creates a new client from Config struct
func NewFromConfig(config Config) (*Client, error) {
- return NewClient(config.GitlabAPIServerURL(), config.GitlabAPISecret(), config.GitlabClientConnectionTimeout(), config.GitlabJWTTokenExpiry())
+ return NewClient(config.InternalGitLabServerURL(), config.GitlabAPISecret(), config.GitlabClientConnectionTimeout(), config.GitlabJWTTokenExpiry())
}
// Resolve returns a VirtualDomain configuration wrapped into a Lookup for a
diff --git a/internal/source/gitlab/client/config.go b/internal/source/gitlab/client/config.go
index 6bd07160..19a87452 100644
--- a/internal/source/gitlab/client/config.go
+++ b/internal/source/gitlab/client/config.go
@@ -5,7 +5,7 @@ import "time"
// Config represents an interface that is configuration provider for client
// capable of comunicating with GitLab
type Config interface {
- GitlabAPIServerURL() string
+ InternalGitLabServerURL() string
GitlabAPISecret() []byte
GitlabClientConnectionTimeout() time.Duration
GitlabJWTTokenExpiry() time.Duration
diff --git a/main.go b/main.go
index ec2bfe49..8ea87202 100644
--- a/main.go
+++ b/main.go
@@ -61,7 +61,7 @@ var (
secret = flag.String("auth-secret", "", "Cookie store hash key, should be at least 32 bytes long.")
gitLabAuthServer = flag.String("auth-server", "", "DEPRECATED, use gitlab-server instead. GitLab server, for example https://www.gitlab.com")
gitLabServer = flag.String("gitlab-server", "", "GitLab server, for example https://www.gitlab.com")
- gitLabAPIServer = flag.String("gitlab-api-server", "", "GitLab server used for API requests, for example https://www.gitlab.com, useful if you want to send that traffic over an internal load balancer (defaults to value of gitlab-server)")
+ internalGitLabServer = flag.String("internal-gitlab-server", "", "Internal GitLab server used for API requests, useful if you want to send that traffic over an internal load balancer, example value https://www.gitlab.com (defaults to value of gitlab-server)")
gitLabAPISecretKey = flag.String("api-secret-key", "", "File with secret key used to authenticate with the GitLab API")
gitlabClientHTTPTimeout = flag.Duration("gitlab-client-http-timeout", 10*time.Second, "GitLab API HTTP client connection timeout in seconds (default: 10s)")
gitlabClientJWTExpiry = flag.Duration("gitlab-client-jwt-expiry", 30*time.Second, "JWT Token expiry time in seconds (default: 30s)")
@@ -108,9 +108,9 @@ func gitlabServerFromFlags() string {
return host.FromString(url.Host)
}
-func gitlabAPIServerFromFlags() string {
- if *gitLabAPIServer != "" {
- return *gitLabAPIServer
+func InternalGitLabServerFromFlags() string {
+ if *internalGitLabServer != "" {
+ return *internalGitLabServer
}
return gitlabServerFromFlags()
@@ -190,7 +190,7 @@ func configFromFlags() appConfig {
}
config.GitLabServer = gitlabServerFromFlags()
- config.GitLabAPIServer = gitlabAPIServerFromFlags()
+ config.InternalGitLabServer = InternalGitLabServerFromFlags()
config.GitlabClientHTTPTimeout = *gitlabClientHTTPTimeout
config.GitlabJWTTokenExpiration = *gitlabClientJWTExpiry
config.StoreSecret = *secret
@@ -275,7 +275,7 @@ func loadConfig() appConfig {
"tls-max-version": *tlsMaxVersion,
"use-http-2": config.HTTP2,
"gitlab-server": config.GitLabServer,
- "gitlab-api-server": config.GitLabAPIServer,
+ "internal-gitlab-server": config.InternalGitLabServer,
"api-secret-key": *gitLabAPISecretKey,
"auth-redirect-uri": config.RedirectURI,
}).Debug("Start daemon with configuration")