fix: secret file reading (#45) (#2664)

* fix: secret file reading

* do ToUpper for keys not only for cli args

* add tests
This commit is contained in:
ChristopherHX
2025-02-12 22:36:50 +01:00
committed by GitHub
parent 3f741df6bc
commit 7fec28d69e
3 changed files with 42 additions and 8 deletions

28
cmd/root_test.go Normal file
View File

@@ -0,0 +1,28 @@
package cmd
import (
"path"
"testing"
"github.com/stretchr/testify/assert"
)
func TestReadSecrets(t *testing.T) {
secrets := map[string]string{}
ret := readEnvsEx(path.Join("testdata", "secrets.yml"), secrets, true)
assert.True(t, ret)
assert.Equal(t, `line1
line2
line3
`, secrets["MYSECRET"])
}
func TestReadEnv(t *testing.T) {
secrets := map[string]string{}
ret := readEnvs(path.Join("testdata", "secrets.yml"), secrets)
assert.True(t, ret)
assert.Equal(t, `line1
line2
line3
`, secrets["mysecret"])
}