-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: unable to bind env variables (#60)
* fix: binding env variables * fix: binding env variables
- Loading branch information
Deepak Sharma
authored
May 19, 2021
1 parent
4de5a80
commit d35e301
Showing
4 changed files
with
47 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package config | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/google/go-cmp/cmp" | ||
) | ||
|
||
func TestViperUnMarshal(t *testing.T) { | ||
os.Setenv("HOST", "host") | ||
os.Setenv("AUTH_TOKEN", "token") | ||
os.Setenv("CONSENT_TELEMETRY", "false") | ||
os.Setenv("CRDA_KEY", "abc") | ||
want := &viperConfigs{ | ||
Host: "host", | ||
AuthToken: "token", | ||
ConsentTelemetry: "false", | ||
CrdaKey: "abc", | ||
} | ||
got := ViperUnMarshal() | ||
if diff := cmp.Diff(want, got); diff != "" { | ||
t.Errorf("Error in ViperUnMarshal func. (-want, +got):\n%s", diff) | ||
} | ||
} |