Exemplo n.º 1
0
// FromFile loads an AWSCredentialStore from the given file and decrypts it
func FromFile(filename string, pass *security.DatabasePassword) (*AWSCredentialStore, error) {
	enc, err := ioutil.ReadFile(filename)
	if err != nil {
		return nil, err
	}

	dec, err := pass.Decrypt(enc)
	if err != nil {
		return nil, err
	}

	t := &AWSCredentialStore{
		databasePassword: pass,
		storageFile:      filename,
	}
	err = yaml.Unmarshal(dec, t)
	return t, err
}