Disable CA download when hosted via HTTP

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
This commit is contained in:
Daniel Jiang 2019-05-06 11:14:39 +08:00
parent f85870511d
commit 6c3df3c8ce

View File

@ -171,6 +171,7 @@ func (sia *SystemInfoAPI) GetGeneralInfo() {
registryURL = l[0] registryURL = l[0]
} }
_, caStatErr := os.Stat(defaultRootCert) _, caStatErr := os.Stat(defaultRootCert)
enableCADownload := caStatErr == nil && strings.HasPrefix(extURL, "https://")
harborVersion := sia.getVersion() harborVersion := sia.getVersion()
info := GeneralInfo{ info := GeneralInfo{
AdmiralEndpoint: utils.SafeCastString(cfg[common.AdmiralEndpoint]), AdmiralEndpoint: utils.SafeCastString(cfg[common.AdmiralEndpoint]),
@ -182,7 +183,7 @@ func (sia *SystemInfoAPI) GetGeneralInfo() {
SelfRegistration: utils.SafeCastBool(cfg[common.SelfRegistration]), SelfRegistration: utils.SafeCastBool(cfg[common.SelfRegistration]),
ExtURL: extURL, ExtURL: extURL,
RegistryURL: registryURL, RegistryURL: registryURL,
HasCARoot: caStatErr == nil, HasCARoot: enableCADownload,
HarborVersion: harborVersion, HarborVersion: harborVersion,
RegistryStorageProviderName: utils.SafeCastString(cfg[common.RegistryStorageProviderName]), RegistryStorageProviderName: utils.SafeCastString(cfg[common.RegistryStorageProviderName]),
ReadOnly: config.ReadOnly(), ReadOnly: config.ReadOnly(),