func NewCertFileWatcher(keyPair KeyPair, opts ...CertFileWatcherOption) (*CertFileWatcher, error) {
	if keyPair.CertPath == "" || keyPair.KeyPath == "" {
		return nil, ex.New(ErrTLSPathsUnset)
	}
	cw := &CertFileWatcher{
		latch:   async.NewLatch(),
		keyPair: keyPair,
	}
	for _, opt := range opts {
		if err := opt(cw); err != nil {
			return nil, err
		}
	}
	cert, err := tls.LoadX509KeyPair(cw.keyPair.CertPath, cw.keyPair.KeyPath)
	if err != nil {
		return nil, err
	}
	cw.certificate = &cert
	return cw, nil
}
// NewCertFileWatcher creates a new CertReloader object with a reload delay
NewCertFileWatcher creates a new CertReloader object with a reload delay
// NewCertFileWatcher creates a new CertReloader object with a reload delay
func NewCertFileWatcher(keyPair KeyPair, opts ...CertFileWatcherOption) (*CertFileWatcher, error) {
	if keyPair.CertPath == "" || keyPair.KeyPath == "" {
		return nil, ex.New(ErrTLSPathsUnset)
	}
	cw := &CertFileWatcher{
		latch:   async.NewLatch(),
		keyPair: keyPair,
	}
	for _, opt := range opts {
		if err := opt(cw); err != nil {
			return nil, err
		}
	}
	cert, err := tls.LoadX509KeyPair(cw.keyPair.CertPath, cw.keyPair.KeyPath)
	if err != nil {
		return nil, err
	}
	cw.certificate = &cert
	return cw, nil
}
func NewCertFileWatcher ( keyPair KeyPair , opts ... CertFileWatcherOption ) ( * CertFileWatcher , error ) { if keyPair . CertPath == " " || keyPair . KeyPath == " " { return nil , ex . New ( ErrTLSPathsUnset ) } cw := & CertFileWatcher { latch : async . NewLatch ( ) , keyPair : keyPair , } for _ , opt := range opts { if err := opt ( cw ) ; err != nil { return nil , err } } cert , err := tls . LoadX509KeyPair ( cw . keyPair . CertPath , cw . keyPair . KeyPath ) if err != nil { return nil , err } cw . certificate = & cert return cw , nil }
NewCertFileWatcher creates a new CertReloader object with a reload delay
NewCertFileWatcher creates a new CertReloader object with a reload delay