mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-10-24 07:09:09 -04:00
Error out if LDAP CA cert is not valid
If the configured LDAP CA cert can not be successfully loaded to the Pool let the creation of the Graph Service fail.
This commit is contained in:
1 parent
ca5952fe34
commit
917f099751
2 files changed
+9
-2
No files matched your search
@@ -59,6 +59,10 @@ func Server(opts ...Option) (http.Service, error) {
|
||||
svc.EventsPublisher(publisher),
|
||||
)
|
||||
|
||||
if handle == nil {
|
||||
return http.Service{}, errors.New("could not initialize graph service")
|
||||
}
|
||||
|
||||
{
|
||||
handle = svc.NewInstrument(handle, options.Metrics)
|
||||
handle = svc.NewLogging(handle, options.Logger)
|
||||
|
||||
@@ -106,10 +106,13 @@ func NewService(opts ...Option) Service {
|
||||
certs := x509.NewCertPool()
|
||||
pemData, err := ioutil.ReadFile(options.Config.Identity.LDAP.CACert)
|
||||
if err != nil {
|
||||
options.Logger.Error().Msgf("Error initializing LDAP Backend: '%s'", err)
|
||||
options.Logger.Error().Err(err).Msgf("Error initializing LDAP Backend")
|
||||
return nil
|
||||
}
|
||||
if !certs.AppendCertsFromPEM(pemData) {
|
||||
options.Logger.Error().Msgf("Error initializing LDAP Backend. Adding CA cert failed")
|
||||
return nil
|
||||
}
|
||||
certs.AppendCertsFromPEM(pemData)
|
||||
tlsConf.RootCAs = certs
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user