remove auth basic command to improve config code

This commit is contained in:
David Christofas
2022-04-25 15:43:15 +02:00
parent 634d557279
commit 57e4e70888
14 changed files with 505 additions and 190 deletions
+25
View File
@@ -0,0 +1,25 @@
package ldap
import (
"errors"
"os"
"time"
"github.com/owncloud/ocis/ocis-pkg/log"
)
const _caTimeout = 5
func WaitForCA(log log.Logger, insecure bool, caCert string) error {
if !insecure && caCert != "" {
if _, err := os.Stat(caCert); errors.Is(err, os.ErrNotExist) {
log.Warn().Str("LDAP CACert", caCert).Msgf("File does not exist. Waiting %d seconds for it to appear.", _caTimeout)
time.Sleep(_caTimeout * time.Second)
if _, err := os.Stat(caCert); errors.Is(err, os.ErrNotExist) {
log.Warn().Str("LDAP CACert", caCert).Msgf("File does still not exist after Timeout")
return err
}
}
}
return nil
}