Skip to content

Commit

Permalink
fix: [NA] use parser and formatter config aliases in censor pkg inste…
Browse files Browse the repository at this point in the history
…ad of original config structs (#30)
  • Loading branch information
vpakhuchyi committed Feb 3, 2024
1 parent f6aba27 commit 0a13bd6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
6 changes: 3 additions & 3 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const DefaultMaskValue = "[CENSORED]"

// Config describes the available parser.Parser and formatter.Formatter configuration.
type Config struct {
General General `yaml:"general"`
Parser parser.Config `yaml:"parser"`
Formatter formatter.Config `yaml:"formatter"`
General General `yaml:"general"`
Parser ParserConfig `yaml:"parser"`
Formatter FormatterConfig `yaml:"formatter"`
}

// General describes general configuration settings.
Expand Down
15 changes: 6 additions & 9 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import (

"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"

"github.com/vpakhuchyi/censor/internal/formatter"
"github.com/vpakhuchyi/censor/internal/parser"
)

func TestDefault(t *testing.T) {
Expand All @@ -17,10 +14,10 @@ func TestDefault(t *testing.T) {
General: General{
PrintConfigOnInit: true,
},
Parser: parser.Config{
Parser: ParserConfig{
UseJSONTagName: false,
},
Formatter: formatter.Config{
Formatter: FormatterConfig{
MaskValue: DefaultMaskValue,
DisplayPointerSymbol: false,
DisplayStructName: false,
Expand Down Expand Up @@ -49,10 +46,10 @@ func TestFromFile(t *testing.T) {
General: General{
PrintConfigOnInit: true,
},
Parser: parser.Config{
Parser: ParserConfig{
UseJSONTagName: true,
},
Formatter: formatter.Config{
Formatter: FormatterConfig{
MaskValue: "[CENSORED]",
DisplayPointerSymbol: true,
DisplayStructName: true,
Expand Down Expand Up @@ -124,10 +121,10 @@ func TestYAMLMarshal(t *testing.T) {
General: General{
PrintConfigOnInit: true,
},
Parser: parser.Config{
Parser: ParserConfig{
UseJSONTagName: true,
},
Formatter: formatter.Config{
Formatter: FormatterConfig{
MaskValue: "[CENSORED]",
DisplayPointerSymbol: true,
DisplayStructName: true,
Expand Down
8 changes: 4 additions & 4 deletions processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -687,10 +687,10 @@ func TestNewWithConfig(t *testing.T) {
General: General{
PrintConfigOnInit: true,
},
Parser: parser.Config{
Parser: ParserConfig{
UseJSONTagName: false,
},
Formatter: formatter.Config{
Formatter: FormatterConfig{
MaskValue: "####",
DisplayPointerSymbol: false,
DisplayStructName: false,
Expand Down Expand Up @@ -808,10 +808,10 @@ func TestProcessor_PrintConfig(t *testing.T) {
General: General{
PrintConfigOnInit: true,
},
Parser: parser.Config{
Parser: ParserConfig{
UseJSONTagName: false,
},
Formatter: formatter.Config{
Formatter: FormatterConfig{
MaskValue: DefaultMaskValue,
DisplayPointerSymbol: true,
DisplayStructName: true,
Expand Down

0 comments on commit 0a13bd6

Please sign in to comment.