This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new a5cff38a Allow override of ldap creds file
a5cff38a is described below

commit a5cff38ac0d85f78a6d3580bfe40a62d0192bd58
Author: Sebb <[email protected]>
AuthorDate: Sat Apr 29 11:06:33 2023 +0100

    Allow override of ldap creds file
---
 lib/whimsy/asf/config.rb | 4 ++++
 lib/whimsy/asf/ldap.rb   | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/whimsy/asf/config.rb b/lib/whimsy/asf/config.rb
index 6d0a7184..4a48287d 100644
--- a/lib/whimsy/asf/config.rb
+++ b/lib/whimsy/asf/config.rb
@@ -64,6 +64,10 @@ module ASF
     @config[:svn] ||= "#{@root}/svn/*"
     @config[:git] ||= "#{@root}/git/*"
 
+    # default location of LDAP credentials
+    @config[:ldap_creds] ||= "/srv/ldap.txt"
+
+
     # The cache is used for local copies of SVN files that may be updated by 
Whimsy
     # for example: podlings.xml
     # www/roster/views/actions/ppmc.json.rb (write)
diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index 73f86e76..9286dcf5 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -46,6 +46,8 @@ module ASF
     # Mutex preventing simultaneous connections to LDAP from a single process
     CONNECT_LOCK = Mutex.new
 
+    LDAP_CREDS = ASF::Config.get(:ldap_creds)
+
     # connect to LDAP
     def self.connect(hosts = nil)
       # If the host list is specified, use that as is
@@ -268,8 +270,8 @@ module ASF
     ASF::LDAP::CONNECT_LOCK.synchronize do
       # fetch the default LDAP connection details
       if @ldap_dn.nil? || @ldap_pw.nil?
-        Wunderbar.info("Reading ldap.txt")
-        File.open("/srv/ldap.txt") do |io|
+        Wunderbar.info("Reading #{ASF::LDAP::LDAP_CREDS}")
+        File.open(ASF::LDAP::LDAP_CREDS) do |io|
           @ldap_dn = io.readline.strip
           @ldap_pw = io.readline.strip
         end

Reply via email to