Esempio n. 1
0
func (r *Registry) InitRegistryClient() error {
	var tlsConfig *tls.Config

	if r.TlsSkipVerify {
		tlsConfig = &tls.Config{InsecureSkipVerify: true}
	}

	rClient, err := registry.NewRegistryClient(r.Addr, tlsConfig, r.Username, r.Password)
	if err != nil {
		return err
	}

	r.registryClient = rClient

	return nil
}
Esempio n. 2
0
func NewRegistry(id, name, addr, username, password string, tls_skip_verify bool) (*Registry, error) {
	var tlsConfig *tls.Config

	if tls_skip_verify {
		tlsConfig = &tls.Config{InsecureSkipVerify: true}
	}

	rClient, err := registry.NewRegistryClient(addr, tlsConfig, username, password)
	if err != nil {
		return nil, err
	}

	return &Registry{
		ID:             id,
		Name:           name,
		Addr:           addr,
		Username:       username,
		Password:       password,
		TlsSkipVerify:  tls_skip_verify,
		registryClient: rClient,
	}, nil
}