Skip to content

Commit

Permalink
fix bugs with tls and api url, see details bellow
Browse files Browse the repository at this point in the history
* Add CRANE_DOCKER_ENTRY_SCHEME in deploy/env, to use docker
  over ssl, must set CRANE_DOCKER_TLS_VERIFY=true and
  CRANE_DOCKER_ENTRY_SCHEME=https at the same time.
* add missing close quote in field tag, DockerTlsVerify wat not
  properly unmarshalled.
* use url.Parse() to initialize Url object, fix error:

    time="2017-09-08T14:58:14+08:00" level=warning msg="get node list error: Get ./https://192.168.x.x:2376/nodes: unsupported protocol scheme \"\""

  note "./" before "https://..."
  • Loading branch information
StephenPCG committed Sep 8, 2017
1 parent ab77015 commit 4ca9fa4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions deploy/env
@@ -1,6 +1,7 @@
CRANE_ADDR=0.0.0.0:5013
CRANE_SWARM_MANAGER_IP
CRANE_DOCKER_TLS_VERIFY=false
CRANE_DOCKER_ENTRY_SCHEME=http
CRANE_DOCKER_ENTRY_PORT=2375
CRANE_DOCKER_API_VERSION=1.24
CRANE_DOCKER_CERT_PATH=null
Expand Down
2 changes: 1 addition & 1 deletion src/utils/config/config.go
Expand Up @@ -15,7 +15,7 @@ type Config struct {
DbDriver string `env:"CRANE_DB_DRIVER,required"`
DbDSN string `env:"CRANE_DB_DSN,required"`
FeatureFlags []string `env:"CRANE_FEATURE_FLAGS,required"`
DockerTlsVerify bool `env:"CRANE_DOCKER_TLS_VERIFY envDefault:"false"`
DockerTlsVerify bool `env:"CRANE_DOCKER_TLS_VERIFY" envDefault:"false"`

// registry
RegistryPrivateKeyPath string `env:"CRANE_REGISTRY_PRIVATE_KEY_PATH,required"`
Expand Down
4 changes: 1 addition & 3 deletions src/utils/httpclient/client.go
Expand Up @@ -290,9 +290,7 @@ func (cli *Client) newRequest(method, path string, query url.Values, body io.Rea
// returns the versioned request path to call the api.
// It appends the query parameters to the path if they are not empty.
func getAPIPath(apiPath string, query url.Values) string {
u := &url.URL{
Path: apiPath,
}
u, _ := url.Parse(apiPath)
if len(query) > 0 {
u.RawQuery = query.Encode()
}
Expand Down

0 comments on commit 4ca9fa4

Please sign in to comment.