1
0
mirror of https://github.com/getsops/sops.git synced 2026-02-05 12:45:21 +01:00

Determine age package path using current file rather than pwd.

This commit is contained in:
Jimmy Cuadra
2020-07-28 03:32:03 -07:00
parent 2741ab530a
commit d9b196c87c

View File

@@ -2,6 +2,8 @@ package age
import (
"os"
"path"
"runtime"
"testing"
"github.com/stretchr/testify/assert"
@@ -20,9 +22,8 @@ func TestAge(t *testing.T) {
err = key.Encrypt(dataKey)
assert.NoError(err)
pwd, err := os.Getwd()
assert.NoError(err)
err = os.Setenv("SOPS_AGE_KEY_DIR", pwd)
_, filename, _, _ := runtime.Caller(0)
err = os.Setenv("SOPS_AGE_KEY_DIR", path.Dir(filename))
assert.NoError(err)
decryptedKey, err := key.Decrypt()