Skip to content

Commit

Permalink
Merge branch 'ory:master' into PLATFORM-6123
Browse files Browse the repository at this point in the history
  • Loading branch information
harnash authored Jul 21, 2021
2 parents b2d4f3d + 5616ea3 commit 4dc4298
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
12 changes: 10 additions & 2 deletions configx/koanf_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,16 @@ func NewKoanfEnv(prefix string, schema []byte) (*env.Env, error) {
}

decode := func(value string) (v interface{}) {
_ = json.Unmarshal([]byte(value), v)
return v
b := []byte(value)
var arr []interface{}
if err := json.Unmarshal(b, &arr); err == nil {
return &arr
}
h := map[string]interface{}{}
if err := json.Unmarshal(b, &h); err == nil {
return &h
}
return nil
}

return env.ProviderWithValue(prefix, ".", func(key string, value string) (string, interface{}) {
Expand Down
1 change: 1 addition & 0 deletions configx/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func TestAdvancedConfigs(t *testing.T) {
stub: "kratos",
configs: []string{"stub/kratos/kratos.yaml"},
isValid: true, envs: [][2]string{
{"SELFSERVICE_METHODS_OIDC_CONFIG_PROVIDERS", `[{"id":"google","provider":"google","mapper_url":"file:///etc/config/kratos/oidc.google.jsonnet","client_id":"[email protected]","client_secret":"secret"}]`},
{"DSN", "sqlite:///var/lib/sqlite/db.sqlite?_fk=true"},
}},
{
Expand Down
13 changes: 12 additions & 1 deletion configx/stub/kratos/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,18 @@
"enabled": true
},
"oidc": {
"enabled": false
"enabled": true,
"config": {
"providers": [
{
"id": "google",
"provider": "google",
"mapper_url": "file:///etc/config/kratos/oidc.google.jsonnet",
"client_id": "[email protected]",
"client_secret": "secret"
}
]
}
},
"password": {
"enabled": true
Expand Down
2 changes: 2 additions & 0 deletions configx/stub/kratos/kratos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ selfservice:
methods:
password:
enabled: true
oidc:
enabled: true

flows:
error:
Expand Down

0 comments on commit 4dc4298

Please sign in to comment.