mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
registry: un-export config.LoadXXX() functions
Un-export: - config.LoadAllowNondistributableArtifacts() - config.LoadInsecureRegistries() - config.LoadMirrors() The config type is already un-exported; this also un-exports these functions to be explicit they're internal only. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
4ebb18479d
commit
6e3e657ea6
3 changed files with 14 additions and 14 deletions
|
@ -79,21 +79,21 @@ func newServiceConfig(options ServiceOptions) (*serviceConfig, error) {
|
|||
// and Mirrors are only for the official registry anyways.
|
||||
},
|
||||
}
|
||||
if err := config.LoadAllowNondistributableArtifacts(options.AllowNondistributableArtifacts); err != nil {
|
||||
if err := config.loadAllowNondistributableArtifacts(options.AllowNondistributableArtifacts); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := config.LoadMirrors(options.Mirrors); err != nil {
|
||||
if err := config.loadMirrors(options.Mirrors); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := config.LoadInsecureRegistries(options.InsecureRegistries); err != nil {
|
||||
if err := config.loadInsecureRegistries(options.InsecureRegistries); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return config, nil
|
||||
}
|
||||
|
||||
// LoadAllowNondistributableArtifacts loads allow-nondistributable-artifacts registries into config.
|
||||
func (config *serviceConfig) LoadAllowNondistributableArtifacts(registries []string) error {
|
||||
// loadAllowNondistributableArtifacts loads allow-nondistributable-artifacts registries into config.
|
||||
func (config *serviceConfig) loadAllowNondistributableArtifacts(registries []string) error {
|
||||
cidrs := map[string]*registrytypes.NetIPNet{}
|
||||
hostnames := map[string]bool{}
|
||||
|
||||
|
@ -129,9 +129,9 @@ func (config *serviceConfig) LoadAllowNondistributableArtifacts(registries []str
|
|||
return nil
|
||||
}
|
||||
|
||||
// LoadMirrors loads mirrors to config, after removing duplicates.
|
||||
// loadMirrors loads mirrors to config, after removing duplicates.
|
||||
// Returns an error if mirrors contains an invalid mirror.
|
||||
func (config *serviceConfig) LoadMirrors(mirrors []string) error {
|
||||
func (config *serviceConfig) loadMirrors(mirrors []string) error {
|
||||
mMap := map[string]struct{}{}
|
||||
unique := []string{}
|
||||
|
||||
|
@ -159,8 +159,8 @@ func (config *serviceConfig) LoadMirrors(mirrors []string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// LoadInsecureRegistries loads insecure registries to config
|
||||
func (config *serviceConfig) LoadInsecureRegistries(registries []string) error {
|
||||
// loadInsecureRegistries loads insecure registries to config
|
||||
func (config *serviceConfig) loadInsecureRegistries(registries []string) error {
|
||||
// Localhost is by default considered as an insecure registry. This is a
|
||||
// stop-gap for people who are running a private registry on localhost.
|
||||
registries = append(registries, "127.0.0.0/8")
|
||||
|
|
|
@ -94,7 +94,7 @@ func TestLoadAllowNondistributableArtifacts(t *testing.T) {
|
|||
}
|
||||
for _, testCase := range testCases {
|
||||
config := emptyServiceConfig
|
||||
err := config.LoadAllowNondistributableArtifacts(testCase.registries)
|
||||
err := config.loadAllowNondistributableArtifacts(testCase.registries)
|
||||
if testCase.err == "" {
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, got '%s'", err)
|
||||
|
@ -237,7 +237,7 @@ func TestLoadInsecureRegistries(t *testing.T) {
|
|||
}
|
||||
for _, testCase := range testCases {
|
||||
config := emptyServiceConfig
|
||||
err := config.LoadInsecureRegistries(testCase.registries)
|
||||
err := config.loadInsecureRegistries(testCase.registries)
|
||||
if testCase.err == "" {
|
||||
if err != nil {
|
||||
t.Fatalf("expect no error, got '%s'", err)
|
||||
|
|
|
@ -84,7 +84,7 @@ func (s *defaultService) LoadAllowNondistributableArtifacts(registries []string)
|
|||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
return s.config.LoadAllowNondistributableArtifacts(registries)
|
||||
return s.config.loadAllowNondistributableArtifacts(registries)
|
||||
}
|
||||
|
||||
// LoadMirrors loads registry mirrors for Service
|
||||
|
@ -92,7 +92,7 @@ func (s *defaultService) LoadMirrors(mirrors []string) error {
|
|||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
return s.config.LoadMirrors(mirrors)
|
||||
return s.config.loadMirrors(mirrors)
|
||||
}
|
||||
|
||||
// LoadInsecureRegistries loads insecure registries for Service
|
||||
|
@ -100,7 +100,7 @@ func (s *defaultService) LoadInsecureRegistries(registries []string) error {
|
|||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
return s.config.LoadInsecureRegistries(registries)
|
||||
return s.config.loadInsecureRegistries(registries)
|
||||
}
|
||||
|
||||
// Auth contacts the public registry with the provided credentials,
|
||||
|
|
Loading…
Reference in a new issue