storj/cmd/identity
Jeff Wendling e74cac52ab
Command line flags features and cleanup (#2068)
* change BindSetup to be an option to Bind
* add process.Bind to allow composite structures
* hack fix for noprefix flags
* used tagged version of structs

Before this PR, some flags were created by calling `cfgstruct.Bind` and having their fields create a flag. Once the flags were parsed, `viper` was used to acquire all the values from them and config files, and the fields in the struct were set through the flag interface.

This doesn't work for slices of things on config structs very well, since it can only set strings, and for a string slice, it turns out that the implementation in `pflag` appends an entry rather than setting it.

This changes three things:

1. Only have a `Bind` call instead of `Bind` and `BindSetup`, and make `BindSetup` an option instead.
2. Add a `process.Bind` call that takes in a `*cobra.Cmd`, binds the struct to the command's flags, and keeps track of that struct in a global map keyed by the command.
3. Use `viper` to get the values and load them into the bound configuration structs instead of using the flags to propagate the changes.

In this way, we can support whatever rich configuration we want in the config yaml files, while still getting command like flags when important.
2019-05-29 17:56:22 +00:00
..
batch.go Command line flags features and cleanup (#2068) 2019-05-29 17:56:22 +00:00
certificate_authority.go Command line flags features and cleanup (#2068) 2019-05-29 17:56:22 +00:00
identity.go Command line flags features and cleanup (#2068) 2019-05-29 17:56:22 +00:00
main.go Command line flags features and cleanup (#2068) 2019-05-29 17:56:22 +00:00
revocations.go Command line flags features and cleanup (#2068) 2019-05-29 17:56:22 +00:00