Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2363 from agentgonzo/vault-install-secrets-yaml
Vault install secrets yaml
- Loading branch information
Showing
64 changed files
with
864 additions
and
414 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
pkg/gits/mocks/matchers/slice_of_ptr_to_gits_gitwebhookarguments.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,59 @@ | ||
package io | ||
|
||
import ( | ||
"io/ioutil" | ||
|
||
"github.com/jenkins-x/jx/pkg/util" | ||
"github.com/pkg/errors" | ||
"gopkg.in/yaml.v2" | ||
) | ||
|
||
// ConfigStore provides an interface for storing configs | ||
type ConfigStore interface { | ||
// Write saves some secret data to the store | ||
Write(name string, bytes []byte) error | ||
|
||
// WriteObject writes a named object to the store | ||
WriteObject(name string, obj interface{}) error | ||
|
||
// Read reads some secret data from the store | ||
Read(name string) ([]byte, error) | ||
|
||
// ReadObject reads an object from the store | ||
ReadObject(name string, object interface{}) error | ||
} | ||
|
||
type fileStore struct { | ||
} | ||
|
||
// NewFileStore creates a ConfigStore that stores its data to the filesystem in YAML | ||
func NewFileStore() ConfigStore { | ||
return &fileStore{} | ||
} | ||
|
||
// Write writes a secret to the filesystem in YAML format | ||
func (f *fileStore) Write(fileName string, bytes []byte) error { | ||
return ioutil.WriteFile(fileName, bytes, util.DefaultWritePermissions) | ||
} | ||
|
||
// WriteObject writes a secret to the filesystem in YAML format | ||
func (f *fileStore) WriteObject(fileName string, obj interface{}) error { | ||
y, err := yaml.Marshal(obj) | ||
if err != nil { | ||
return errors.Wrapf(err, "Unable to marshal object to yaml: %v", obj) | ||
} | ||
return f.Write(fileName, y) | ||
} | ||
|
||
func (f *fileStore) Read(fileName string) ([]byte, error) { | ||
return ioutil.ReadFile(fileName) | ||
} | ||
|
||
// ReadObject reads an object from the filesystem as yaml | ||
func (f *fileStore) ReadObject(fileName string, object interface{}) error { | ||
data, err := f.Read(fileName) | ||
if err != nil { | ||
return errors.Wrapf(err, "Unable to read %s", fileName) | ||
} | ||
return yaml.Unmarshal(data, object) | ||
} |
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
Oops, something went wrong.