Skip to content

Commit 15c9c56

Browse files
committed
update readme to support functions and hashes instead of only functions
1 parent aedbb4c commit 15c9c56

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ require "code0/identities"
3131
begin
3232

3333
identity = Code0::Identities::Provider::Discord.new(
34-
-> {
34+
{
3535
redirect_uri : "http://localhost:8080/redirect",
3636
client_id : "id"
3737
client_secret : "xxxx"
@@ -70,4 +70,25 @@ identity_provider.load_identity(:gitlab, params)
7070

7171
identity_provider.load_identity(:my_custom_gitlab_provider, params)
7272

73+
```
74+
75+
We also support passing in a function as a configuration instead of a hash
76+
77+
```ruby
78+
79+
def get_identity
80+
provider = Code0::Identities::Provider::Discord.new(fetch_configuration)
81+
82+
provider.load_identity(params)
83+
end
84+
85+
def fetch_configuration
86+
# Do some database action, to dynamicly load the configuration
87+
# {
88+
redirect_uri : "http://localhost:8080/redirect",
89+
client_id : "some dynamic value"
90+
client_secret : "xxxx"
91+
}
92+
end
93+
7394
```

0 commit comments

Comments
 (0)