mirror of
https://github.com/glauth/glauth.git
synced 2026-10-27 06:26:59 +00:00
Compare commits
23 Commits
v2.4.0
...
dev-deprecated
| Author | SHA1 | Date | |
|---|---|---|---|
| fbef6a70fa | |||
| 48537deabd | |||
| ebab2a0910 | |||
| 7cbb176686 | |||
| f474f883d4 | |||
| 8c3fe078b2 | |||
| f65ee3d63b | |||
| 6b6a64ce6a | |||
| fad9d82e76 | |||
| 6c2ecbfcd6 | |||
| c551cab56f | |||
| aa0414f02e | |||
| 349431c6ca | |||
| 15ed058754 | |||
| 675b236328 | |||
| 75d02ee368 | |||
| 0c11325a24 | |||
| 0c7a513852 | |||
| d8398285f1 | |||
| 27c9d4cb42 | |||
| 3114106563 | |||
| 75abe08313 | |||
| 4e62b7cd89 |
+32
-24
@@ -3,6 +3,15 @@ package main
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
|
"strings"
|
||||||
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/GeertJohan/yubigo"
|
"github.com/GeertJohan/yubigo"
|
||||||
"github.com/arl/statsviz"
|
"github.com/arl/statsviz"
|
||||||
docopt "github.com/docopt/docopt-go"
|
docopt "github.com/docopt/docopt-go"
|
||||||
@@ -18,12 +27,6 @@ import (
|
|||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"gopkg.in/amz.v3/aws"
|
"gopkg.in/amz.v3/aws"
|
||||||
"gopkg.in/amz.v3/s3"
|
"gopkg.in/amz.v3/s3"
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"reflect"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const programName = "glauth"
|
const programName = "glauth"
|
||||||
@@ -112,40 +115,45 @@ func startService() {
|
|||||||
server.Logger(log),
|
server.Logger(log),
|
||||||
server.Config(activeConfig),
|
server.Config(activeConfig),
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("could not create server")
|
log.Error().Err(err).Msg("could not create server")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if activeConfig.LDAP.Enabled {
|
if activeConfig.LDAP.Enabled {
|
||||||
// Don't block if also starting a LDAPS server afterwards
|
go func() {
|
||||||
shouldBlock := !activeConfig.LDAPS.Enabled
|
|
||||||
|
|
||||||
if shouldBlock {
|
|
||||||
if err := s.ListenAndServe(); err != nil {
|
if err := s.ListenAndServe(); err != nil {
|
||||||
log.Error().Err(err).Msg("could not start LDAP server")
|
log.Error().Err(err).Msg("could not start LDAP server")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
} else {
|
}()
|
||||||
go func() {
|
|
||||||
if err := s.ListenAndServe(); err != nil {
|
|
||||||
log.Error().Err(err).Msg("could not start LDAP server")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if activeConfig.LDAPS.Enabled {
|
if activeConfig.LDAPS.Enabled {
|
||||||
// Always block here
|
go func() {
|
||||||
if err := s.ListenAndServeTLS(); err != nil {
|
if err := s.ListenAndServeTLS(); err != nil {
|
||||||
log.Error().Err(err).Msg("could not start LDAPS server")
|
log.Error().Err(err).Msg("could not start LDAPS server")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||||
|
|
||||||
|
// Block until we receive our signal.
|
||||||
|
<-c
|
||||||
|
|
||||||
|
// Doesn't block if no connections, but will otherwise wait
|
||||||
|
// until the timeout deadline.
|
||||||
|
s.Shutdown()
|
||||||
|
|
||||||
|
// Optionally, you could run srv.Shutdown in a goroutine and block on
|
||||||
|
// <-ctx.Done() if your application should wait for other services
|
||||||
|
// to finalize based on context cancellation.
|
||||||
log.Info().Msg("AP exit")
|
log.Info().Msg("AP exit")
|
||||||
os.Exit(1)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func startConfigWatcher() {
|
func startConfigWatcher() {
|
||||||
|
|||||||
Reference in New Issue
Block a user