Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"os"
"os/exec"
"strings"

"github.com/google/uuid"
)

const (
Expand Down Expand Up @@ -55,12 +53,7 @@ func (e Editor) Launch(path string) error {
}

func (e Editor) LaunchTemp(r io.Reader) ([]byte, string, error) {
uuid, err := uuid.NewRandom()
if err != nil {
return []byte{}, "", err
}
tmpf := fmt.Sprintf("/dev/shm/%v", uuid)
f, err := os.OpenFile(tmpf, os.O_RDWR|os.O_CREATE, 0600)
f, err := ioutil.TempFile("", "*.helm")
if err != nil {
return nil, "", err
}
Expand Down
18 changes: 5 additions & 13 deletions wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"os/exec"
"strings"

"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -185,22 +184,15 @@ func decryptSecrets(args []string) ([]string, []string, error) {
if err != nil {
return helmArgs, decryptedFiles, err
}
// Store decrypted contents in a shm file
uuid, err := uuid.NewRandom()
if err != nil {
return helmArgs, decryptedFiles, err
}
tmpf := fmt.Sprintf("/dev/shm/%v", uuid)
// Store decrypted contents in a tmp file
f, err := ioutil.TempFile("", "*.helm")
tmpf := f.Name()
decryptedFiles = append(decryptedFiles, tmpf)
_, err = os.OpenFile(tmpf, os.O_RDWR|os.O_CREATE, 0600)
if err != nil {
return helmArgs, decryptedFiles, err
}
err = ioutil.WriteFile(tmpf, plain, 0644)
_, err = f.Write(plain)
if err != nil {
return helmArgs, decryptedFiles, err
}
// Update args to access the decrypt shm file instead
// Update args to access the decrypt tmp file instead
helmArgs[i+1] = tmpf
}
}
Expand Down