Remove fmt.Println and add Zerolog logging system
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 1m2s
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 1m2s
This commit is contained in:
@@ -4,7 +4,9 @@ import (
|
||||
"context"
|
||||
"crypto/rsa"
|
||||
"errors"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.coopgo.io/coopgo-platform/mobility-accounts/handlers"
|
||||
@@ -18,7 +20,14 @@ import (
|
||||
|
||||
func NewProvider(c OIDCNamespaceConfig, h handlers.MobilityAccountsHandler, s storage.Storage, privateKey *rsa.PrivateKey) fosite.OAuth2Provider {
|
||||
|
||||
config := &compose.Config{}
|
||||
config := &compose.Config{
|
||||
RedirectSecureChecker: func(checkUrl *url.URL) bool {
|
||||
if strings.HasSuffix(checkUrl.Host, "svc.cluster.local") || strings.HasSuffix(checkUrl.Host, "localhost") {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
}
|
||||
storage := NewOIDCProviderStore(c, h, s.KV)
|
||||
secret := []byte(c.SecretKey)
|
||||
return compose.ComposeAllEnabled(config, storage, secret, privateKey)
|
||||
|
||||
@@ -3,12 +3,12 @@ package op
|
||||
import (
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"fmt"
|
||||
|
||||
"git.coopgo.io/coopgo-platform/mobility-accounts/handlers"
|
||||
"git.coopgo.io/coopgo-platform/mobility-accounts/storage"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/ory/fosite"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
@@ -86,14 +86,14 @@ func Run(done chan error, cfg *viper.Viper, handler handlers.MobilityAccountsHan
|
||||
address = "0.0.0.0:" + cfg.GetString("services.oidc_provider.port")
|
||||
)
|
||||
|
||||
fmt.Println("-> OIDC provider endpoints on", address)
|
||||
log.Info().Str("address", address).Msg("Running OIDC provider")
|
||||
|
||||
s := NewOIDCHandler(handler, storage, cfg)
|
||||
|
||||
err := NewOIDCServer(s, cfg)
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("OIDC server ended")
|
||||
log.Error().Err(err).Msg("OIDC server ended")
|
||||
}
|
||||
|
||||
done <- err
|
||||
|
||||
Reference in New Issue
Block a user