outposts/ldap: fix log formatter and level not being set correctly
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
dcbc3d788a
commit
fc9d270992
|
@ -21,6 +21,12 @@ Required environment variables:
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.SetLevel(log.DebugLevel)
|
log.SetLevel(log.DebugLevel)
|
||||||
|
log.SetFormatter(&log.JSONFormatter{
|
||||||
|
FieldMap: log.FieldMap{
|
||||||
|
log.FieldKeyMsg: "event",
|
||||||
|
log.FieldKeyTime: "timestamp",
|
||||||
|
},
|
||||||
|
})
|
||||||
akURL, found := os.LookupEnv("AUTHENTIK_HOST")
|
akURL, found := os.LookupEnv("AUTHENTIK_HOST")
|
||||||
if !found {
|
if !found {
|
||||||
fmt.Println("env AUTHENTIK_HOST not set!")
|
fmt.Println("env AUTHENTIK_HOST not set!")
|
||||||
|
|
|
@ -14,7 +14,8 @@ import (
|
||||||
|
|
||||||
func doGlobalSetup(outpost api.Outpost, globalConfig api.Config) {
|
func doGlobalSetup(outpost api.Outpost, globalConfig api.Config) {
|
||||||
l := log.WithField("logger", "authentik.outpost")
|
l := log.WithField("logger", "authentik.outpost")
|
||||||
if !outpost.Managed.IsSet() {
|
m := outpost.Managed.Get()
|
||||||
|
if m == nil || *m == "" {
|
||||||
switch outpost.Config[ConfigLogLevel].(string) {
|
switch outpost.Config[ConfigLogLevel].(string) {
|
||||||
case "trace":
|
case "trace":
|
||||||
log.SetLevel(log.TraceLevel)
|
log.SetLevel(log.TraceLevel)
|
||||||
|
|
|
@ -57,7 +57,7 @@ func (ls *LDAPServer) StartLDAPServer() error {
|
||||||
proxyListener := &proxyproto.Listener{Listener: ln}
|
proxyListener := &proxyproto.Listener{Listener: ln}
|
||||||
defer proxyListener.Close()
|
defer proxyListener.Close()
|
||||||
|
|
||||||
ls.log.WithField("listen", listen).Info("Starting ldap server")
|
ls.log.WithField("listen", listen).Info("Starting LDAP server")
|
||||||
err = ls.s.Serve(proxyListener)
|
err = ls.s.Serve(proxyListener)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -45,7 +45,7 @@ func (ls *LDAPServer) StartLDAPTLSServer() error {
|
||||||
|
|
||||||
tln := tls.NewListener(proxyListener, tlsConfig)
|
tln := tls.NewListener(proxyListener, tlsConfig)
|
||||||
|
|
||||||
ls.log.WithField("listen", listen).Info("Starting ldap tls server")
|
ls.log.WithField("listen", listen).Info("Starting LDAP SSL server")
|
||||||
err = ls.s.Serve(tln)
|
err = ls.s.Serve(tln)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Reference in New Issue