Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify all custom types to enable custom YAML marshalling and unmarshalling #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

clarafu
Copy link

@clarafu clarafu commented Apr 15, 2021

For concourse/concourse#6434

With the epic for converting concourse to start up using a config file, we no longer use go-flags to unmarshal into these custom types but rather use yaml unmarshalling. This pr converts all the flags to have custom YAML unmarshallers.

I also added yaml marshalers because I want to support generating a config file from an existing configuration struct. This can be useful to help users migrate from deploying with flags to a config file, without needing users to write up a config file from scratch. It can also be helpful for giving users their most up-to-date configuration field values.

Lastly, this commit also adds support for three methods, Set, String and Type making it conform to the pflags.Value interface https://pkg.go.dev/github.com/spf13/pflag?utm_source=godoc#Value. These are used by cobra in order to support a custom type being used in parsing flags. Once we fully deprecate flags, we can delete these methods.

With concourse converting to starting up with a config file, we no
longer use go-flags to unmarshal into these custom types but now it uses
yaml unmarshalling. So I converted all the flags to have custom yaml
unmarshallers.

I also added yaml marshalers because I want to support generating a
config file from an existing configuration struct. This can be useful to
help users migrate from deploying with flags to a config file, without
needing users to write up a config file from scratch. It can also be
helpful for giving users their most up-to-date configuration field
values.

Lastly, this commit also adds support for three methods, Set, String and
Type. These are used by cobra in order to support a custom type being
used in parsing flags. Once we fully deprecate flags, we can delete
these methods.

[concourse/concourse#6434]

Signed-off-by: Clara Fu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants