Merge pull request #7642 from reasonerjt/root-ca-flag

Disable CA download when hosted via HTTP
This commit is contained in:
Wenkai Yin 2019-05-06 14:55:13 +08:00 committed by GitHub
commit e48a148485
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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