mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-18 14:47:38 +01:00
Merge pull request #7593 from reasonerjt/ext-url-systeminfo
Add Ext URL to response of systeminfo API
This commit is contained in:
commit
56c7d55c73
@ -3998,6 +3998,12 @@ definitions:
|
||||
admiral_endpoint:
|
||||
type: string
|
||||
description: The url of the endpoint of admiral instance.
|
||||
registry_url:
|
||||
type: string
|
||||
description: The url of registry against which the docker command should be issued.
|
||||
external_url:
|
||||
type: string
|
||||
description: The external URL of Harbor, with protocol.
|
||||
auth_mode:
|
||||
type: string
|
||||
description: The auth mode of current Harbor instance.
|
||||
|
@ -97,6 +97,7 @@ type GeneralInfo struct {
|
||||
AuthMode string `json:"auth_mode"`
|
||||
AuthProxySettings *models.HTTPAuthProxy `json:"authproxy_settings,omitempty"`
|
||||
RegistryURL string `json:"registry_url"`
|
||||
ExtURL string `json:"external_url"`
|
||||
ProjectCreationRestrict string `json:"project_creation_restriction"`
|
||||
SelfRegistration bool `json:"self_registration"`
|
||||
HasCARoot bool `json:"has_ca_root"`
|
||||
@ -162,8 +163,9 @@ func (sia *SystemInfoAPI) GetGeneralInfo() {
|
||||
sia.SendInternalServerError(fmt.Errorf("Unexpected error: %v", err))
|
||||
return
|
||||
}
|
||||
extURL := cfg[common.ExtEndpoint].(string)
|
||||
var registryURL string
|
||||
if l := strings.Split(cfg[common.ExtEndpoint].(string), "://"); len(l) > 1 {
|
||||
if l := strings.Split(extURL, "://"); len(l) > 1 {
|
||||
registryURL = l[1]
|
||||
} else {
|
||||
registryURL = l[0]
|
||||
@ -178,6 +180,7 @@ func (sia *SystemInfoAPI) GetGeneralInfo() {
|
||||
AuthMode: utils.SafeCastString(cfg[common.AUTHMode]),
|
||||
ProjectCreationRestrict: utils.SafeCastString(cfg[common.ProjectCreationRestriction]),
|
||||
SelfRegistration: utils.SafeCastBool(cfg[common.SelfRegistration]),
|
||||
ExtURL: extURL,
|
||||
RegistryURL: registryURL,
|
||||
HasCARoot: caStatErr == nil,
|
||||
HarborVersion: harborVersion,
|
||||
|
Loading…
Reference in New Issue
Block a user