7 proxy "github.com/pusher/oauth2_proxy"
8 "github.com/stretchr/testify/assert"
12 TestField string `cfg:"target_field" env:"TEST_ENV_FIELD"`
16type EnvTestEmbed struct {
17 TestFieldEmbed string `cfg:"target_field_embed" env:"TEST_ENV_FIELD_EMBED"`
20func TestLoadEnvForStruct(t *testing.T) {
22 cfg := make(proxy.EnvOptions)
23 cfg.LoadEnvForStruct(&EnvTest{})
25 _, ok := cfg["target_field"]
26 assert.Equal(t, ok, false)
28 os.Setenv("TEST_ENV_FIELD", "1234abcd")
29 cfg.LoadEnvForStruct(&EnvTest{})
30 v := cfg["target_field"]
31 assert.Equal(t, v, "1234abcd")
34func TestLoadEnvForStructWithEmbeddedFields(t *testing.T) {
36 cfg := make(proxy.EnvOptions)
37 cfg.LoadEnvForStruct(&EnvTest{})
39 _, ok := cfg["target_field_embed"]
40 assert.Equal(t, ok, false)
42 os.Setenv("TEST_ENV_FIELD_EMBED", "1234abcd")
43 cfg.LoadEnvForStruct(&EnvTest{})
44 v := cfg["target_field_embed"]
45 assert.Equal(t, v, "1234abcd")
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list