This repository has been archived by the owner on Jun 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for secrets in composefiles
Signed-off-by: Jean-Christophe Sirot <[email protected]>
- Loading branch information
Jean-Christophe Sirot
committed
Oct 4, 2019
1 parent
0942d5c
commit c8d3cb0
Showing
4 changed files
with
81 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package secrets | ||
|
||
import ( | ||
"crypto/sha256" | ||
"fmt" | ||
) | ||
|
||
// Secrets represents a secret map | ||
type Secrets map[string]Secret | ||
|
||
// Secret represents a secret | ||
type Secret struct { | ||
Path string | ||
External bool | ||
Name string | ||
} | ||
|
||
// New creates a new empty secret map | ||
func New() Secrets { | ||
return make(map[string]Secret) | ||
} | ||
|
||
// NormalizeFilename generates a filename for this secret to be mounted in the invocation image | ||
func (s *Secret) NormalizeFilename() string { | ||
digest := sha256.Sum256([]byte(s.Path)) | ||
return fmt.Sprintf("/cnab/app/secret/%x", digest) | ||
} |
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