mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-18 04:41:26 +01:00
Merge pull request #446 from ywk253100/insecure_env
pass insecure env to ui
This commit is contained in:
commit
34a93348a7
@ -98,7 +98,8 @@ render(os.path.join(templates_dir, "ui", "env"),
|
|||||||
ldap_url=ldap_url,
|
ldap_url=ldap_url,
|
||||||
ldap_basedn=ldap_basedn,
|
ldap_basedn=ldap_basedn,
|
||||||
self_registration=self_registration,
|
self_registration=self_registration,
|
||||||
ui_secret=ui_secret)
|
ui_secret=ui_secret,
|
||||||
|
verify_remote_cert=verify_remote_cert)
|
||||||
|
|
||||||
render(os.path.join(templates_dir, "ui", "app.conf"),
|
render(os.path.join(templates_dir, "ui", "app.conf"),
|
||||||
ui_conf,
|
ui_conf,
|
||||||
|
@ -17,3 +17,4 @@ LOG_LEVEL=debug
|
|||||||
GODEBUG=netdns=cgo
|
GODEBUG=netdns=cgo
|
||||||
EXT_ENDPOINT=$ui_url
|
EXT_ENDPOINT=$ui_url
|
||||||
TOKEN_URL=http://ui
|
TOKEN_URL=http://ui
|
||||||
|
VERIFY_REMOTE_CERT=$verify_remote_cert
|
||||||
|
12
api/base.go
12
api/base.go
@ -19,6 +19,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/astaxie/beego/validation"
|
"github.com/astaxie/beego/validation"
|
||||||
@ -136,3 +137,14 @@ func (b *BaseAPI) GetIDFromURL() int64 {
|
|||||||
|
|
||||||
return id
|
return id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getIsInsecure() bool {
|
||||||
|
insecure := false
|
||||||
|
|
||||||
|
verifyRemoteCert := os.Getenv("VERIFY_REMOTE_CERT")
|
||||||
|
if verifyRemoteCert == "off" {
|
||||||
|
insecure = true
|
||||||
|
}
|
||||||
|
|
||||||
|
return insecure
|
||||||
|
}
|
||||||
|
@ -271,12 +271,10 @@ func (ra *RepositoryAPI) GetManifests() {
|
|||||||
|
|
||||||
func (ra *RepositoryAPI) initRepositoryClient(repoName string) (r *registry.Repository, err error) {
|
func (ra *RepositoryAPI) initRepositoryClient(repoName string) (r *registry.Repository, err error) {
|
||||||
endpoint := os.Getenv("REGISTRY_URL")
|
endpoint := os.Getenv("REGISTRY_URL")
|
||||||
// TODO read variable from config file
|
|
||||||
insecure := true
|
|
||||||
|
|
||||||
username, password, ok := ra.Ctx.Request.BasicAuth()
|
username, password, ok := ra.Ctx.Request.BasicAuth()
|
||||||
if ok {
|
if ok {
|
||||||
return newRepositoryClient(endpoint, insecure, username, password,
|
return newRepositoryClient(endpoint, getIsInsecure(), username, password,
|
||||||
repoName, "repository", repoName, "pull", "push", "*")
|
repoName, "repository", repoName, "pull", "push", "*")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +283,7 @@ func (ra *RepositoryAPI) initRepositoryClient(repoName string) (r *registry.Repo
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return cache.NewRepositoryClient(endpoint, insecure, username, repoName,
|
return cache.NewRepositoryClient(endpoint, getIsInsecure(), username, repoName,
|
||||||
"repository", repoName, "pull", "push", "*")
|
"repository", repoName, "pull", "push", "*")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,9 +92,7 @@ func (t *TargetAPI) Ping() {
|
|||||||
password = t.GetString("password")
|
password = t.GetString("password")
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO read variable from config file
|
registry, err := newRegistryClient(endpoint, getIsInsecure(), username, password,
|
||||||
insecure := true
|
|
||||||
registry, err := newRegistryClient(endpoint, insecure, username, password,
|
|
||||||
"", "", "")
|
"", "", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// timeout, dns resolve error, connection refused, etc.
|
// timeout, dns resolve error, connection refused, etc.
|
||||||
|
Loading…
Reference in New Issue
Block a user