Skip to content

Commit

Permalink
Rename prefix option to filter
Browse files Browse the repository at this point in the history
It also includes the description of each option
  • Loading branch information
leocomelli committed Jan 11, 2022
1 parent bcf5636 commit b91e59f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
16 changes: 8 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var (
type Options struct {
Provider string
Project string
Prefix string
Filter string
Parser string
Template string
Output string
Expand All @@ -39,13 +39,13 @@ type Options struct {
func main() {
options := &Options{}

flag.StringVar(&options.Provider, "provider", "gcp", "")
flag.StringVar(&options.Project, "project", "", "")
flag.StringVar(&options.Prefix, "secret-prefix", "", "")
flag.StringVar(&options.Parser, "secret-data-parser", "plaintext", "")
flag.StringVar(&options.Template, "template", "", "")
flag.StringVar(&options.Output, "output", "", "")
v := flag.Bool("version", false, "")
flag.StringVar(&options.Provider, "provider", "gcp", "name of the provider that manages the secrets")
flag.StringVar(&options.Project, "project", "", "gcp project that contains the secrets")
flag.StringVar(&options.Filter, "filter", "", "regex to filter secrets by name")
flag.StringVar(&options.Parser, "data-parser", "plaintext", "parse secret based on data type")
flag.StringVar(&options.Template, "template", "", "template to render secret data")
flag.StringVar(&options.Output, "output", "", "path to write output file to")
v := flag.Bool("version", false, "show the current secrets-init version")

flag.Parse()

Expand Down
5 changes: 5 additions & 0 deletions provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ func TestFilter(t *testing.T) {
`^myapp*|^xxx*`,
false,
},
{
"app_password",
``,
true,
},
}

gcp := &GCPSecretManager{}
Expand Down
2 changes: 1 addition & 1 deletion runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func Run(options *Options) error {
return err
}

data, err := provider.ListSecrets(options.Project, options.Prefix)
data, err := provider.ListSecrets(options.Project, options.Filter)
if err != nil {
return err
}
Expand Down

0 comments on commit b91e59f

Please sign in to comment.