forked from anchore/syft
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1465 attestation with private key (anchore#1502)
1465 attestation with private key (anchore#1502) Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
- Loading branch information
Showing
7 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package options | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/pflag" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
type AttestOptions struct { | ||
Key string | ||
} | ||
|
||
var _ Interface = (*AttestOptions)(nil) | ||
|
||
func (o AttestOptions) AddFlags(cmd *cobra.Command, v *viper.Viper) error { | ||
cmd.Flags().StringVarP(&o.Key, "key", "k", "", "the key to use for the attestation") | ||
return bindAttestConfigOptions(cmd.Flags(), v) | ||
} | ||
|
||
func bindAttestConfigOptions(flags *pflag.FlagSet, v *viper.Viper) error { | ||
if err := v.BindPFlag("attest.key", flags.Lookup("key")); err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package config | ||
|
||
import "github.com/spf13/viper" | ||
|
||
type attest struct { | ||
Key string `yaml:"key" json:"key" mapstructure:"key"` | ||
Password string `yaml:"password" json:"password" mapstructure:"password"` | ||
} | ||
|
||
func (cfg attest) loadDefaultValues(v *viper.Viper) { | ||
v.SetDefault("attest.key", "") | ||
v.SetDefault("attest.password", "") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters