fix stripping config options

This commit is contained in:
Jeff
2019-09-27 23:50:28 +08:00
committed by zryfish
parent 416719aae3
commit 967c4ca2fe
2 changed files with 11 additions and 1 deletions

View File

@@ -250,7 +250,7 @@ func (c *Config) stripEmptyOptions() {
c.LdapOptions = nil
}
if c.OpenPitrixOptions != nil && len(c.OpenPitrixOptions.Validate()) > 0 {
if c.OpenPitrixOptions != nil && c.OpenPitrixOptions.IsEmpty() {
c.OpenPitrixOptions = nil
}

View File

@@ -30,6 +30,16 @@ func (s *OpenPitrixOptions) ApplyTo(options *OpenPitrixOptions) {
}
}
func (s *OpenPitrixOptions) IsEmpty() bool {
return s.RuntimeManagerEndpoint == "" &&
s.ClusterManagerEndpoint == "" &&
s.RepoManagerEndpoint == "" &&
s.AppManagerEndpoint == "" &&
s.CategoryManagerEndpoint == "" &&
s.AttachmentManagerEndpoint == "" &&
s.RepoIndexerEndpoint == ""
}
func (s *OpenPitrixOptions) Validate() []error {
var errs []error