fix: remove noise log when core started (#18260)

Fixes: #18126

Signed-off-by: chlins <chenyuzh@vmware.com>
This commit is contained in:
Chlins Zhang 2023-02-21 17:38:42 +08:00 committed by GitHub
parent 99b37117e1
commit 4141d77407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 6 deletions

View File

@ -25,6 +25,11 @@ import (
"github.com/goharbor/harbor/src/pkg/project"
"github.com/goharbor/harbor/src/pkg/project/metadata"
"github.com/goharbor/harbor/src/pkg/repository"
// init the db config
_ "github.com/goharbor/harbor/src/pkg/config/db"
// init the rest config
_ "github.com/goharbor/harbor/src/pkg/config/rest"
)
// Define global resource manager.

View File

@ -77,12 +77,14 @@ var (
func init() {
registryHTTPClientTimeout = DefaultHTTPClientTimeout
// override it if read from environment variable, in minutes
timeout, err := strconv.ParseInt(os.Getenv("REGISTRY_HTTP_CLIENT_TIMEOUT"), 10, 64)
if err != nil {
log.Errorf("Failed to parse REGISTRY_HTTP_CLIENT_TIMEOUT: %v, use default value: %v", err, DefaultHTTPClientTimeout)
} else {
if timeout > 0 {
registryHTTPClientTimeout = time.Duration(timeout) * time.Minute
if env := os.Getenv("REGISTRY_HTTP_CLIENT_TIMEOUT"); len(env) > 0 {
timeout, err := strconv.ParseInt(env, 10, 64)
if err != nil {
log.Errorf("Failed to parse REGISTRY_HTTP_CLIENT_TIMEOUT: %v, use default value: %v", err, DefaultHTTPClientTimeout)
} else {
if timeout > 0 {
registryHTTPClientTimeout = time.Duration(timeout) * time.Minute
}
}
}
}