Skip to content

Commit

Permalink
fix cipher yaml loading (#56)
Browse files Browse the repository at this point in the history
* fix cipher yaml loading

* [skip ci] prepare for v0.4.1 release
  • Loading branch information
kcajmagic authored Apr 18, 2019
1 parent a568976 commit 3b625a8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [v0.4.1]
- fixed cipher yaml loading

## [v0.4.0]
- Added kid and alg to `db` package
- Updated loading cipher options
Expand Down Expand Up @@ -95,7 +98,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Initial creation
- Created `db` and `xvault` package

[Unreleased]: https://github.com/Comcast/codex/compare/v0.4.0...HEAD
[Unreleased]: https://github.com/Comcast/codex/compare/v0.4.1..HEAD
[v0.4.1]: https://github.com/Comcast/codex/compare/v0.4.0...v0.4.1
[v0.4.0]: https://github.com/Comcast/codex/compare/v0.3.3...v0.4.0
[v0.3.3]: https://github.com/Comcast/codex/compare/v0.3.2...v0.3.3
[v0.3.2]: https://github.com/Comcast/codex/compare/v0.3.1...v0.3.2
Expand Down
7 changes: 0 additions & 7 deletions cipher/noop.json

This file was deleted.

5 changes: 5 additions & 0 deletions cipher/noop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cipher:
- type: none
kid: none
- type: box
kid: rip
9 changes: 1 addition & 8 deletions cipher/viper.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cipher

import (
"encoding/json"
"github.com/go-kit/kit/log"
"github.com/goph/emperror"
"github.com/spf13/viper"
Expand Down Expand Up @@ -62,12 +61,6 @@ func (c *Ciphers) Get(alg AlgorithmType, KID string) (Decrypt, bool) {
// FromViper produces an Options from a (possibly nil) Viper instance.
// cipher key is expected
func FromViper(v *viper.Viper) (o Options, err error) {
obj := v.Get("cipher")
data, err := json.Marshal(obj)
if err != nil {
return []Config{}, emperror.Wrap(err, "failed to load cipher config")
}

err = json.Unmarshal(data, &o)
err = v.UnmarshalKey(CipherKey, &o)
return
}

0 comments on commit 3b625a8

Please sign in to comment.