Skip to content

Commit

Permalink
update readme to support functions and hashes instead of only functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Knerio committed Aug 25, 2024
1 parent aedbb4c commit 15c9c56
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require "code0/identities"
begin

identity = Code0::Identities::Provider::Discord.new(
-> {
{
redirect_uri : "http://localhost:8080/redirect",
client_id : "id"
client_secret : "xxxx"
Expand Down Expand Up @@ -70,4 +70,25 @@ identity_provider.load_identity(:gitlab, params)

identity_provider.load_identity(:my_custom_gitlab_provider, params)

```

We also support passing in a function as a configuration instead of a hash

```ruby

def get_identity
provider = Code0::Identities::Provider::Discord.new(fetch_configuration)

provider.load_identity(params)
end

def fetch_configuration
# Do some database action, to dynamicly load the configuration
# {
redirect_uri : "http://localhost:8080/redirect",
client_id : "some dynamic value"
client_secret : "xxxx"
}
end

```

0 comments on commit 15c9c56

Please sign in to comment.