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

Add file based configuration. #121

Merged
merged 1 commit into from
Aug 25, 2022
Merged

Add file based configuration. #121

merged 1 commit into from
Aug 25, 2022

Conversation

wlynch
Copy link
Member

@wlynch wlynch commented Aug 22, 2022

Summary

This adds git-config based configuration for gitsign values.

Caveats:

Signed-off-by: Billy Lynch billy@chainguard.dev

Fixes #99

Release Note

Documentation

Will update once new release is cut. This is a backwards compatible change.

This adds [git-config](https://git-scm.com/docs/git-config) based
configuration for gitsign values.

Caveats:
- GITSIGN_CREDENTIAL_CACHE intentionally not supported since this is
  likely changing soon.
- We do not use subsections (i.e. we use gitsign.issuer instead of gitsign.oidc.issuer).
  This gives us some wiggle room to add host based config later on
  similar to https://git-scm.com/docs/gitcredentials

Signed-off-by: Billy Lynch <billy@chainguard.dev>
Copy link
Member

@cpanato cpanato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

lgtm

Copy link
Member

@eddiezane eddiezane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! One foot gun preventing suggestion.

out.Issuer = o.Value
case "logPath":
out.LogPath = o.Value
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know git eats output but Is there a way you can warn about an unknown (or mistyped) value in the default case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bit of a chicken and egg problem, since we use the config to set up some of the output writers (i.e. GITSIGN_LOG).

We could refactor just the tty input/output setup to capture this if we really wanted, but I'm also not too worried about it - this behavior is something that is present for most git configs (i.e. you can do git config --local gpg.foo bar and it won't complain), and it seems to be manageable for most people. We still have -v as a fall back to verify parsed values as a sanity check.

@wlynch wlynch merged commit f215bd8 into sigstore:main Aug 25, 2022
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.

File based configuration
4 participants