Skip to content

Commit

Permalink
fix: init from the main config
Browse files Browse the repository at this point in the history
  • Loading branch information
anvari1313 committed Sep 10, 2024
1 parent e971027 commit 9ce1756
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion internal/authenticator/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (b Builder) Authenticators() (map[string]Authenticator, error) {

switch vendor.Type {
case "auto", "validator", "validator-based", "using-validator":
auth, err = b.autoAuthenticator(vendor)
auth, err = b.autoAuthenticator(vendor, b.BlackListUserLoggingConfig)
if err != nil {
return nil, fmt.Errorf("cannot build auto authenticator %w", err)
}
Expand Down
16 changes: 9 additions & 7 deletions internal/cmd/serve/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import (
"os"
"os/signal"

"github.com/snapp-incubator/soteria/internal/api"
"github.com/snapp-incubator/soteria/internal/authenticator"
"github.com/snapp-incubator/soteria/internal/config"
"github.com/spf13/cobra"
"go.opentelemetry.io/otel/trace"
"go.uber.org/zap"

"github.com/snapp-incubator/soteria/internal/api"
"github.com/snapp-incubator/soteria/internal/authenticator"
"github.com/snapp-incubator/soteria/internal/config"
)

type Serve struct {
Expand All @@ -23,10 +24,11 @@ type Serve struct {

func (s Serve) main() {
auth, err := authenticator.Builder{
Vendors: s.Cfg.Vendors,
Logger: s.Logger,
ValidatorConfig: s.Cfg.Validator,
Tracer: s.Tracer,
Vendors: s.Cfg.Vendors,
Logger: s.Logger,
ValidatorConfig: s.Cfg.Validator,
Tracer: s.Tracer,
BlackListUserLoggingConfig: s.Cfg.BlackListUserLogging,
}.Authenticators()
if err != nil {
s.Logger.Fatal("authenticator building failed", zap.Error(err))
Expand Down
13 changes: 7 additions & 6 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ const (
type (
// Config is the main container of Soteria's config.
Config struct {
Vendors []Vendor `json:"vendors,omitempty" koanf:"vendors"`
Logger logger.Config `json:"logger,omitempty" koanf:"logger"`
HTTPPort int `json:"http_port,omitempty" koanf:"http_port"`
Tracer tracing.Config `json:"tracer,omitempty" koanf:"tracer"`
DefaultVendor string `json:"default_vendor,omitempty" koanf:"default_vendor"`
Validator Validator `json:"validator,omitempty" koanf:"validator"`
Vendors []Vendor `json:"vendors,omitempty" koanf:"vendors"`

Check failure on line 29 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / lint

tag is not aligned, should be: json:"vendors,omitempty" koanf:"vendors" (tagalign)
Logger logger.Config `json:"logger,omitempty" koanf:"logger"`

Check failure on line 30 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / lint

tag is not aligned, should be: json:"logger,omitempty" koanf:"logger" (tagalign)
HTTPPort int `json:"http_port,omitempty" koanf:"http_port"`

Check failure on line 31 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / lint

tag is not aligned, should be: json:"http_port,omitempty" koanf:"http_port" (tagalign)
Tracer tracing.Config `json:"tracer,omitempty" koanf:"tracer"`

Check failure on line 32 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / lint

tag is not aligned, should be: json:"tracer,omitempty" koanf:"tracer" (tagalign)
DefaultVendor string `json:"default_vendor,omitempty" koanf:"default_vendor"`

Check failure on line 33 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / lint

tag is not aligned, should be: json:"default_vendor,omitempty" koanf:"default_vendor" (tagalign)
Validator Validator `json:"validator,omitempty" koanf:"validator"`

Check failure on line 34 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / lint

tag is not aligned, should be: json:"validator,omitempty" koanf:"validator" (tagalign)
BlackListUserLogging BlackListUserLogging `json:"black_list_user_logging,omitempty" koanf:"black_list_user_logging"`

Check failure on line 35 in internal/config/config.go

View workflow job for this annotation

GitHub Actions / lint

tag is not aligned, should be: json:"black_list_user_logging,omitempty" koanf:"black_list_user_logging" (tagalign)
}

Vendor struct {
Expand Down

0 comments on commit 9ce1756

Please sign in to comment.