Skip to content

Commit

Permalink
Renaming unzip to zip, in light of "upload" cmd.
Browse files Browse the repository at this point in the history
  • Loading branch information
Otávio Fernandes committed Mar 30, 2019
1 parent 99dbc6c commit 9902788
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ secrets:
data:
- name: foo
extension: txt
unzip: false
zip: false
nameAsSubPath: false
```
Expand All @@ -86,7 +86,7 @@ Description of the options used in manifest:
`/secret/data`, while in V1 API it would be directly `/secret`;
- `name.data.name`: file name;
- `name.data.extension`: file extension;
- `name.data.unzip`: file contents is GZIP, needs to be decompressed;
- `name.data.zip`: file contents is GZIP, needs to be compressed/decompressed;
- `name.data.nameAsSubPath`: employ name as final part of the Vault path `name.path`;

### File Naming Convention
Expand Down
8 changes: 4 additions & 4 deletions pkg/vault-handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (h *Handler) Upload(manifest *Manifest) error {
logger = logger.WithFields(log.Fields{
"name": data.Name,
"extension": data.Extension,
"unzip": data.Unzip,
"zip": data.Zip,
})
logger.Info("Handling file")

Expand All @@ -60,7 +60,7 @@ func (h *Handler) Upload(manifest *Manifest) error {
return err
}

if data.Unzip {
if data.Zip {
if err = file.Zip(); err != nil {
logger.Error("error on zipping payload", err)
return err
Expand Down Expand Up @@ -92,7 +92,7 @@ func (h *Handler) Download(manifest *Manifest) error {
logger.WithFields(log.Fields{
"name": data.Name,
"extension": data.Extension,
"unzip": data.Unzip,
"zip": data.Zip,
"vaultPath": vaultPath,
}).Info("Reading data from Vault")

Expand All @@ -101,7 +101,7 @@ func (h *Handler) Download(manifest *Manifest) error {
}
file := NewFile(group, &data, payload)

if data.Unzip {
if data.Zip {
if err = file.Unzip(); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/vault-handler/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Secrets struct {
type SecretData struct {
Name string `yaml:"name"` // file name
Extension string `yaml:"extension"` // file extension
Unzip bool `yaml:"unzip,omitempty"` // unzip data after download
Zip bool `yaml:"zip,omitempty"` // deal with zipped payload
NameAsSubPath bool `yaml:"nameAsSubPath,omitempty"` // employ name as part of the path
}

Expand Down
2 changes: 1 addition & 1 deletion test/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ secrets:
# file extension
extension: txt # when using "file" as type
# unzip payload
unzip: false # only when having "file" as type
zip: false # only when having "file" as type
# use key-name as part of vault path
nameAsSubPath: false

0 comments on commit 9902788

Please sign in to comment.