From bee882eae0346789fc37970eb6041edf799b88c4 Mon Sep 17 00:00:00 2001 From: Daniel Pierce Date: Tue, 19 Nov 2024 13:45:03 -0500 Subject: [PATCH] Update readme config examples --- README.md | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 14349c0..512f028 100644 --- a/README.md +++ b/README.md @@ -32,12 +32,37 @@ u.member_of_ldap_group?(['Some-Group']) ## Configuration -Create a file `config/ldap_groups_lookup.yml` that looks like: +### Initializer +Create an initializer `config/initializers/ldap_groups_lookup.rb` that looks like: +```ruby +LDAPGroupsLookup.config = { + enabled: true, + config: { host: 'ads.example.net', + port: 636, + encryption: { + method: :simple_tls, + tls_options: OpenSSL::SSL::SSLContext::DEFAULT_PARAMS, + }, + auth: { + method: :simple, + username: "cn=example", + password: 'changeme', + } + }, + tree: 'dc=ads,dc=example,dc=net', + account_ou: 'ou=Accounts', + group_ou: 'ou=Groups', + member_whitelist: ['OU=Groups'] +} +``` + +### YAML +Alternatively, create a file `config/ldap_groups_lookup.yml` that looks like: ```yaml :enabled: true :host: ads.example.net -:port: 636 +:port: 389 :auth: :method: :simple :username: example @@ -47,4 +72,5 @@ Create a file `config/ldap_groups_lookup.yml` that looks like: :group_ou: ou=Groups :member_whitelist: - OU=Groups -``` \ No newline at end of file +``` +Note: The yaml style does not allow for easy configuration of some properties like tls_options or other auth methods. \ No newline at end of file