Skip to content

Commit

Permalink
fix: load env vars having $ in value correctly (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-suhas authored Dec 12, 2022
1 parent bcd07ed commit cdfd99c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion recipe/envs.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func populateDataFromLocal() map[string]string {
for _, envvar := range os.Environ() {
keyval := strings.SplitN(envvar, "=", 2) // "sampleKey=sample=Value" returns ["sampleKey", "sample=value"]
key := keyval[0]
val := os.ExpandEnv(keyval[1])
val := keyval[1]

key, ok := mapToMeteorKey(key)
if !ok {
Expand Down
6 changes: 4 additions & 2 deletions recipe/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

var (
emptyConfigPath = ""
username = "admin"
password = "1234"
username = "[email protected]"
password = "TempPa$sword"
)

func TestReaderRead(t *testing.T) {
Expand Down Expand Up @@ -307,6 +307,8 @@ func TestReaderRead(t *testing.T) {
}

func compareRecipes(t *testing.T, expected, actual recipe.Recipe) {
t.Helper()

assert.Equal(t, expected.Name, actual.Name)
assert.Equal(t, len(expected.Sinks), len(actual.Sinks))
assert.Equal(t, len(expected.Processors), len(actual.Processors))
Expand Down
4 changes: 2 additions & 2 deletions recipe/sample_config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SOURCE:
USERNAME: admin
PASSWORD: "1234"
USERNAME: [email protected]
PASSWORD: "TempPa$sword"
4 changes: 2 additions & 2 deletions recipe/testdata/config2.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SOURCE:
USERNAME: admin
PASSWORD: "1234"
USERNAME: [email protected]
PASSWORD: "TempPa$sword"

0 comments on commit cdfd99c

Please sign in to comment.