-
Notifications
You must be signed in to change notification settings - Fork 138
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
feat: use git config to read tsa server and include-certs #64
base: main
Are you sure you want to change the base?
Changes from all commits
37706f5
541cfc5
c872390
104105d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import ( | |
"io" | ||
"os" | ||
|
||
git "github.com/libgit2/git2go/v30" | ||
"github.com/github/certstore" | ||
"github.com/pborman/getopt/v2" | ||
"github.com/pkg/errors" | ||
|
@@ -72,6 +73,26 @@ func runCommand() error { | |
return nil | ||
} | ||
|
||
// read tsa and include-certs from gitconfig | ||
path, err := os.Getwd() | ||
if err == nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason we want to "fail open" here and not return if an error is returned? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. read tsa and include-cert should be optional, so just use the defaults if these are not defined within git config |
||
repo, err := git.OpenRepository(path) | ||
if err == nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question about failing open. The idiom used throughout is |
||
config, err := repo.Config() | ||
|
||
tsa, err := config.LookupString("gpg.x509.smimesign.timestamp-authority") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do we get from |
||
if err == nil { | ||
tsaOpt = &tsa | ||
} | ||
|
||
includeCerts32, err := config.LookupInt32("gpg.x509.smimesign.include-certs") | ||
if err == nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question here..if no such setting is set..do we get |
||
var includeCerts int = int(includeCerts32) | ||
includeCertsOpt = &includeCerts | ||
} | ||
} | ||
} | ||
|
||
// Open certificate store | ||
store, err := certstore.Open() | ||
if err != nil { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️