X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/28e50cc9480fdad416404542511a172cdc7253c7..62c33a15f68895d6a388f68d2827e9fd5705c5df:/sdk/go/arvados/config.go diff --git a/sdk/go/arvados/config.go b/sdk/go/arvados/config.go index 757d0745e7..7ab8d9e1f6 100644 --- a/sdk/go/arvados/config.go +++ b/sdk/go/arvados/config.go @@ -23,7 +23,8 @@ var DefaultConfigFile = func() string { }() type Config struct { - Clusters map[string]Cluster + Clusters map[string]Cluster + AutoReloadConfig bool } // GetConfig returns the current system config, loading it from @@ -66,6 +67,7 @@ type WebDAVCacheConfig struct { MaxPermissionEntries int MaxUUIDEntries int } + type Cluster struct { ClusterID string `json:"-"` ManagementToken string @@ -133,13 +135,39 @@ type Cluster struct { Repositories string } Login struct { - GoogleClientID string - GoogleClientSecret string - GoogleAlternateEmailAddresses bool - ProviderAppID string - ProviderAppSecret string - LoginCluster string - RemoteTokenRefresh Duration + LDAP struct { + Enable bool + URL URL + StartTLS bool + InsecureTLS bool + StripDomain string + AppendDomain string + SearchAttribute string + SearchBindUser string + SearchBindPassword string + SearchBase string + SearchFilters string + EmailAttribute string + UsernameAttribute string + } + Google struct { + Enable bool + ClientID string + ClientSecret string + AlternateEmailAddresses bool + } + PAM struct { + Enable bool + Service string + DefaultEmailDomain string + } + SSO struct { + Enable bool + ProviderAppID string + ProviderAppSecret string + } + LoginCluster string + RemoteTokenRefresh Duration } Mail struct { MailchimpAPIKey string @@ -214,6 +242,8 @@ type Cluster struct { VocabularyURL string WelcomePageHTML string InactivePageHTML string + SSHHelpPageHTML string + SSHHelpHostSuffix string } ForceLegacyAPI14 bool @@ -419,6 +449,24 @@ var errDuplicateInstanceTypeName = errors.New("duplicate instance type name") // UnmarshalJSON handles old config files that provide an array of // instance types instead of a hash. func (it *InstanceTypeMap) UnmarshalJSON(data []byte) error { + fixup := func(t InstanceType) (InstanceType, error) { + if t.ProviderType == "" { + t.ProviderType = t.Name + } + if t.Scratch == 0 { + t.Scratch = t.IncludedScratch + t.AddedScratch + } else if t.AddedScratch == 0 { + t.AddedScratch = t.Scratch - t.IncludedScratch + } else if t.IncludedScratch == 0 { + t.IncludedScratch = t.Scratch - t.AddedScratch + } + + if t.Scratch != (t.IncludedScratch + t.AddedScratch) { + return t, fmt.Errorf("InstanceType %q: Scratch != (IncludedScratch + AddedScratch)", t.Name) + } + return t, nil + } + if len(data) > 0 && data[0] == '[' { var arr []InstanceType err := json.Unmarshal(data, &arr) @@ -434,19 +482,9 @@ func (it *InstanceTypeMap) UnmarshalJSON(data []byte) error { if _, ok := (*it)[t.Name]; ok { return errDuplicateInstanceTypeName } - if t.ProviderType == "" { - t.ProviderType = t.Name - } - if t.Scratch == 0 { - t.Scratch = t.IncludedScratch + t.AddedScratch - } else if t.AddedScratch == 0 { - t.AddedScratch = t.Scratch - t.IncludedScratch - } else if t.IncludedScratch == 0 { - t.IncludedScratch = t.Scratch - t.AddedScratch - } - - if t.Scratch != (t.IncludedScratch + t.AddedScratch) { - return fmt.Errorf("%v: Scratch != (IncludedScratch + AddedScratch)", t.Name) + t, err := fixup(t) + if err != nil { + return err } (*it)[t.Name] = t } @@ -462,8 +500,9 @@ func (it *InstanceTypeMap) UnmarshalJSON(data []byte) error { *it = InstanceTypeMap(hash) for name, t := range *it { t.Name = name - if t.ProviderType == "" { - t.ProviderType = name + t, err := fixup(t) + if err != nil { + return err } (*it)[name] = t }