engine: LoadSecret->NewSecret

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2022-01-07 11:52:16 -08:00
parent 6a70271ff2
commit 5f840723e2
5 changed files with 25 additions and 25 deletions

View File

@@ -12,13 +12,13 @@ import (
)
func init() {
Register("LoadSecret", func() Task { return &loadSecretTask{} })
Register("NewSecret", func() Task { return &newSecretTask{} })
}
type loadSecretTask struct {
type newSecretTask struct {
}
func (t *loadSecretTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) {
func (t *newSecretTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) {
path, err := v.Lookup("path").String()
if err != nil {
return nil, err
@@ -49,6 +49,6 @@ func (t *loadSecretTask) Run(ctx context.Context, pctx *plancontext.Context, s s
secret := pctx.Secrets.New(plaintext)
return compiler.NewValue().FillFields(map[string]interface{}{
"contents": secret.MarshalCUE(),
"output": secret.MarshalCUE(),
})
}