Only allow valid LDAP::Config instances.

When trying to instantiate a new, but unknown provider, guidance is provided to get the correct provider

RuntimeError: Unknown provider (henk). Available providers: ["ldapmain"]
parent faf54d52
......@@ -8,11 +8,16 @@ module Gitlab
Gitlab.config.ldap.enabled
end
def servers
def self.servers
Gitlab.config.ldap.servers
end
def self.providers
servers.map &:provider_name
end
def initialize(provider)
raise "Unknown provider (#{provider}). Available providers: #{self.class.providers}"
@provider = provider
@options = config_for(provider)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment