remove auth basic command to improve config code
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user