cschiewek / devise_ldap_authenticatable

Devise Module for LDAP
MIT License
594 stars 359 forks source link

Add psych4 support #276

Open schlumpfit opened 2 years ago

schlumpfit commented 2 years ago
aminbs commented 1 year ago

Hello will this PR be merged?

spacemunkay commented 7 months ago

While waiting for this to merge and release, one can meanwhile set the ldap_config to a proc in the Devise initializer:

/config/initializers/devise.rb

Devise.setup do |config|
  config.ldap_config = Proc.new do
    YAML.load(ERB.new(File.read("#{Rails.root}/config/ldap.yml")).result, aliases: true)[Rails.env]
  end
end

See: https://github.com/cschiewek/devise_ldap_authenticatable/blob/6ef2131e79ff3421429f8d1b0645c6e113db4dc7/lib/devise_ldap_authenticatable/ldap/connection.rb#L7

Matt7983 commented 4 months ago

While waiting for this to merge and release, one can meanwhile set the ldap_config to a proc in the Devise initializer:

/config/initializers/devise.rb

Devise.setup do |config|
  config.ldap_config = Proc.new do
    YAML.load(ERB.new(File.read("#{Rails.root}/config/ldap.yml")).result, aliases: true)[Rails.env]
  end
end

See:

https://github.com/cschiewek/devise_ldap_authenticatable/blob/6ef2131e79ff3421429f8d1b0645c6e113db4dc7/lib/devise_ldap_authenticatable/ldap/connection.rb#L7

Use the similar method, here's my ldap_config setting: config.ldap_config = Proc.new() {YAML.unsafe_load(ERB.new(File.read("#{Rails.root}/config/ldap.yml")).result)[Rails.env]}