Changes required to implement config files that can be overridden locally.
[eq/.git] / bin / parse_ward_data
index c2397cf211ee586971b917ac5a964508788ef28e..e6d94fb4e1670239ce13538b8df23a1d62597a41 100755 (executable)
@@ -3,14 +3,10 @@
 use DBI;
 use Getopt::Std;
 
-###################################################
-# GLOBALS
-$dbname = "phpgroupware";
-$dbhost = "192.168.0.2"; # This can be an IP address or a name
-$dbport = 3306;
-$dbuser = "phpgroupware"; # This may require an additional '\@localhost'
-$dbpass = "phpgroupware"; 
-###################################################
+$mydir = `cd \$(dirname $0) 2>/dev/null; pwd`; chomp($mydir);
+unshift @INC,("$mydir/../setup");
+if( -f "$mydir/../setup/db_config.local") { require "db_config.local"; }
+else { require "db_config"; }
 
 %hometeaching_data = ();
 %membership_data = ();
@@ -94,7 +90,7 @@ sub print_birthdays
 
 ###################################################
 # Open a connection to the database
-$dbh=DBI->connect("dbi:mysql:dbname=$dbname;host=$dbhost;port=$dbport",$dbuser,$dbpass,{
+$dbh=DBI->connect("dbi:mysql:dbname=$dbname:host=$dbhost:port=$dbport",$dbuser,$dbpass,{
     AutoCommit=>0,
     PrintError=>0}) or print "Connect Failure:".$DBI::errstr."\n" and exit 2;