зеркало из https://github.com/getsops/sops.git
address comments
This commit is contained in:
Родитель
4b99fa18b3
Коммит
4d4891588d
|
@ -81,7 +81,7 @@ func Register(auditor Auditor) {
|
|||
auditors = append(auditors, auditor)
|
||||
}
|
||||
|
||||
// Auditor is notified when noteworthy events happen, for example when a file is encrypted or decrypted.
|
||||
// Auditor is notified when noteworthy events happen, for example when a file is encrypted or decrypted.
|
||||
type Auditor interface {
|
||||
Handle(event interface{})
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ type PostgresAuditor struct {
|
|||
DB *sql.DB
|
||||
}
|
||||
|
||||
// NewPostgresAuditor is the constructor for a new PostgresAuditor object
|
||||
// NewPostgresAuditor is the constructor for a new PostgresAuditor struct
|
||||
// initialized with the given db connection string
|
||||
func NewPostgresAuditor(connStr string) (*PostgresAuditor, error) {
|
||||
db, err := sql.Open("postgres", connStr)
|
||||
|
|
|
@ -24,8 +24,8 @@ import (
|
|||
"gopkg.in/urfave/cli.v1"
|
||||
)
|
||||
|
||||
// ExampleFileEmitter represents actions needed for a struct to be comliant
|
||||
// with the sops example-file emitter interface
|
||||
// ExampleFileEmitter emits example files. This is used by the `sops` binary
|
||||
// whenever a new file is created, in order to present the user with a non-empty file
|
||||
type ExampleFileEmitter interface {
|
||||
EmitExample() []byte
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ type GCSDestination struct {
|
|||
gcsPrefix string
|
||||
}
|
||||
|
||||
// NewGCSDestination is the constructor for a new Google Cloud Storage destination
|
||||
// NewGCSDestination is the constructor for a Google Cloud Storage destination
|
||||
func NewGCSDestination(gcsBucket string, gcsPrefix string) *GCSDestination {
|
||||
return &GCSDestination{gcsBucket, gcsPrefix}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ func (gcsd *GCSDestination) Path(fileName string) string {
|
|||
return fmt.Sprintf("gcs://%s/%s%s", gcsd.gcsBucket, gcsd.gcsPrefix, fileName)
|
||||
}
|
||||
|
||||
// Upload uploads contents to a new file in GCS
|
||||
// Upload uploads contents to a file in GCS
|
||||
func (gcsd *GCSDestination) Upload(fileContents []byte, fileName string) error {
|
||||
ctx := context.Background()
|
||||
client, err := storage.NewClient(ctx)
|
||||
|
|
|
@ -15,7 +15,7 @@ type S3Destination struct {
|
|||
s3Prefix string
|
||||
}
|
||||
|
||||
// NewS3Destination is the constructor for a new S3 Destination
|
||||
// NewS3Destination is the constructor for an S3 Destination
|
||||
func NewS3Destination(s3Bucket string, s3Prefix string) *S3Destination {
|
||||
return &S3Destination{s3Bucket, s3Prefix}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ func (s3d *S3Destination) Path(fileName string) string {
|
|||
return fmt.Sprintf("s3://%s/%s%s", s3d.s3Bucket, s3d.s3Prefix, fileName)
|
||||
}
|
||||
|
||||
// Upload uploads contents to a new file in an S3 Destination (bucket)
|
||||
// Upload uploads contents to a file in an S3 Destination (bucket)
|
||||
func (s3d *S3Destination) Upload(fileContents []byte, fileName string) error {
|
||||
sess := session.Must(session.NewSession())
|
||||
svc := s3.New(sess)
|
||||
|
|
2
sops.go
2
sops.go
|
@ -101,7 +101,7 @@ type TreeItem struct {
|
|||
type TreeBranch []TreeItem
|
||||
|
||||
// TreeBranches is a collection of TreeBranch
|
||||
// trees usually have more than one branch
|
||||
// Trees usually have more than one branch
|
||||
type TreeBranches []TreeBranch
|
||||
|
||||
func valueFromPathAndLeaf(path []interface{}, leaf interface{}) interface{} {
|
||||
|
|
|
@ -101,7 +101,7 @@ func (store Store) treeBranchToYamlMap(in sops.TreeBranch) yaml.MapSlice {
|
|||
return branch
|
||||
}
|
||||
|
||||
// LoadEncryptedFile loads the contexts of an encrypted yaml file onto a
|
||||
// LoadEncryptedFile loads the contents of an encrypted yaml file onto a
|
||||
// sops.Tree runtime object
|
||||
func (store *Store) LoadEncryptedFile(in []byte) (sops.Tree, error) {
|
||||
var data []yaml.MapSlice
|
||||
|
@ -138,7 +138,7 @@ func (store *Store) LoadEncryptedFile(in []byte) (sops.Tree, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// LoadPlainFile loads the contexts of a plaintext yaml file onto a
|
||||
// LoadPlainFile loads the contents of a plaintext yaml file onto a
|
||||
// sops.Tree runtime obejct
|
||||
func (store *Store) LoadPlainFile(in []byte) (sops.TreeBranches, error) {
|
||||
var data []yaml.MapSlice
|
||||
|
|
Загрузка…
Ссылка в новой задаче