From 71c6714f447542ad2e765be3458e3aa3b3e456bb Mon Sep 17 00:00:00 2001 From: Doug Freed Date: Fri, 18 Dec 2015 12:13:16 +0400 Subject: Make web scripts load DB configuration from ASM --- cgi-bin/query.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cgi-bin/query.pl') diff --git a/cgi-bin/query.pl b/cgi-bin/query.pl index 4a9ed26..35c2455 100755 --- a/cgi-bin/query.pl +++ b/cgi-bin/query.pl @@ -7,7 +7,13 @@ use DBI; use CGI_Lite; -my $dbh = DBI->connect("DBI:mysql:database=asm_main;host=localhost;port=3306", 'USER', 'PASSWORD'); +use XML::Simple qw(:strict); +my $xs1 = XML::Simple->new( KeyAttr => ['id'], Cache => [ qw/memcopy/ ]); +my $sqlconf = $xs1->XMLin( "/home/icxcnika/AntiSpamMeta/config-main/mysql.xml", + ForceArray => ['ident', 'geco'], + 'GroupTags' => { ignoredidents => 'ident', ignoredgecos => 'geco' }); + +my $dbh = DBI->connect("DBI:mysql:database=" . $sqlconf->{db} . ";host=" . $sqlconf->{host} . ";port=" . $sqlconf->{port}, $sqlconf->{user}, $sqlconf->{pass}); my $debug = 0; -- cgit v1.2.3