Skip to content

Commit

Permalink
fix: ignore fields that don't have an ssm tag
Browse files Browse the repository at this point in the history
  • Loading branch information
briskt committed Sep 29, 2023
1 parent 239f089 commit c763ae6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ssmconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (p *Provider) Process(configPath string, c interface{}) error {
}

for i, field := range spec {
if field.name == "" && field.defaultValue == "" {
if field.name == "" {
continue
}

Expand Down
5 changes: 5 additions & 0 deletions ssmconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ func TestProvider_Process(t *testing.T) {
F322 float32 `ssm:"/float32/f322" default:"42.42"`
F641 float64 `ssm:"/float64/f641"`
F642 float64 `ssm:"/float64/f642" default:"42.42"`
NoSSM string `default:"ignored"`
Invalid string
}
s.NoSSM = "pre"

mc := &mockSSMClient{
output: &ssm.GetParametersOutput{
Expand Down Expand Up @@ -130,6 +132,9 @@ func TestProvider_Process(t *testing.T) {
if s.F642 != 42.42 {
t.Errorf("Process() F642 unexpected value: want %f, have %f", 42.42, s.F642)
}
if s.NoSSM != "pre" {
t.Errorf("Process() NoSSM unexpected value: want %q, have %q", "pre", s.NoSSM)
}
if s.Invalid != "" {
t.Errorf("Process() Missing unexpected value: want %q, have %q", "", s.Invalid)
}
Expand Down

0 comments on commit c763ae6

Please sign in to comment.