Skip to content

Commit

Permalink
feat: support passing single values for array fields
Browse files Browse the repository at this point in the history
  • Loading branch information
invakid404 committed Aug 28, 2024
1 parent dead4b7 commit dead46d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions oauth/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ func ToOAuthClient(oauth *oauth.OAuth, id string, data map[string]any) (*fosite.
}
}

// Environment variable convenience stuff:
// Allow passing string arrays as a single value
for _, key := range []string{"audience", "redirect_uris", "response_types", "grant_types", "scopes"} {
if value, ok := data[key].(string); ok {
data[key] = []string{value}
}
}

// Allow passing boolean values as strings
for _, key := range []string{"public"} {
if value, ok := data[key].(string); ok {
data[key] = value == "true"
}
}

var client fosite.DefaultClient
config := &mapstructure.DecoderConfig{
Metadata: nil,
Expand Down

0 comments on commit dead46d

Please sign in to comment.