diff -u -p -Nr --exclude CVS --exclude debian --exclude '*.orig' orig/mailgraph-1.14/mailgraph.cfg mailgraph-1.14/mailgraph.cfg
--- orig/mailgraph-1.14/mailgraph.cfg	1970-01-01 01:00:00.000000000 +0100
+++ mailgraph-1.14/mailgraph.cfg	2007-09-15 14:09:03.000000000 +0200
@@ -0,0 +1,15 @@
+[general]
+hostname = this mailhost
+rrd = /var/lib/mailgraph/mailgraph.rd
+rrd_virus = /var/lib/mailgraph/mailgraph_virus.rrd
+tmp_dir = /var/lib/mailgraph
+css = /mailgraph.css
+
+[graphs]
+xpoints = 540
+ypoints = 160
+
+[colors]
+sent     = 000099
+received = 009900
+
diff -u -p -Nr --exclude CVS --exclude debian --exclude '*.orig' orig/mailgraph-1.14/mailgraph.cgi mailgraph-1.14/mailgraph.cgi
--- orig/mailgraph-1.14/mailgraph.cgi	2007-08-29 11:06:01.000000000 +0200
+++ mailgraph-1.14/mailgraph.cgi	2007-09-15 14:09:52.000000000 +0200
@@ -10,6 +10,7 @@ use POSIX qw(uname);
 
 my $VERSION = "1.14";
 
+my $cfg = '/etc/mailgraph.cfg';
 my $host = (POSIX::uname())[1];
 my $scriptname = 'mailgraph.cgi';
 my $xpoints = 540;
@@ -19,6 +20,7 @@ my $ypoints_err = 96;
 my $rrd = 'mailgraph.rrd'; # path to where the RRD database is
 my $rrd_virus = 'mailgraph_virus.rrd'; # path to where the Virus RRD database is
 my $tmp_dir = '/tmp/mailgraph'; # temporary directory where to store the images
+my $path_css = 'mailgraph.css';
 
 my @graphs = (
 	{ title => 'Last Day',   seconds => 3600*24,        },
@@ -36,6 +38,24 @@ my %color = (
 	spam     => '999999',
 );
 
+if (-r $cfg) {
+   use Config::Tiny;
+   my $config = Config::Tiny->read($cfg);
+
+   $host = $config->{general}{hostname} if exists $config->{general}{hostname};
+   $rrd = $config->{general}{rrd} if exists $config->{general}{rrd};
+   $rrd_virus = $config->{general}{rrd_virus} if exists $config->{general}{rrd_virus};
+   $tmp_dir = $config->{general}{tmpdir} if exists $config->{general}{tmpdir};
+   $path_css = $config->{general}{css} if exists $config->{general}{css};
+
+   $xpoints = $config->{graphs}{xpoints} if exists $config->{graphs}{xpoints};
+   $ypoints = $config->{graphs}{ypoints} if exists $config->{graphs}{ypoints};
+
+   foreach (keys %color) {
+       $color{$_} = $config->{colors}{$_} if exists $config->{colors}{$_};
+   }
+}
+
 sub rrd_graph(@)
 {
 	my ($range, $file, $ypoints, @rrdargs) = @_;
@@ -163,7 +183,7 @@ sub print_html()
 <title>Mail statistics for $host</title>
 <meta http-equiv="Refresh" content="300" />
 <meta http-equiv="Pragma" content="no-cache" />
-<link rel="stylesheet" href="mailgraph.css" type="text/css" />
+<link rel="stylesheet" href="$path_css" type="text/css" />
 </head>
 <body>
 HEADER
diff -u -p -Nr --exclude CVS --exclude debian --exclude '*.orig' orig/mailgraph-1.14/mailgraph.pl mailgraph-1.14/mailgraph.pl
--- orig/mailgraph-1.14/mailgraph.pl	2007-08-29 11:06:01.000000000 +0200
+++ mailgraph-1.14/mailgraph.pl	2007-09-15 13:58:32.000000000 +0200
@@ -367,6 +367,7 @@ use POSIX 'setsid';
 my $VERSION = "1.14";
 
 # config
+my $cfg = '/etc/mailgraph.cfg';
 my $rrdstep = 60;
 my $xpoints = 540;
 my $points_per_sample = 3;
@@ -377,8 +378,8 @@ my $daemon_rrd_dir = '/var/log';
 
 # global variables
 my $logfile;
-my $rrd = "mailgraph.rrd";
-my $rrd_virus = "mailgraph_virus.rrd";
+my $rrd = "/var/lib/mailgraph/mailgraph.rrd";
+my $rrd_virus = "/var/lib/mailgraph/mailgraph_virus.rrd";
 my $year;
 my $this_minute;
 my %sum = ( sent => 0, received => 0, bounced => 0, rejected => 0, virus => 0, spam => 0 );
@@ -386,6 +387,16 @@ my $rrd_inited=0;
 
 my %opt = ();
 
+if (-r $cfg) {
+   use Config::Tiny;
+   my $config = Config::Tiny->read($cfg);
+
+   $rrd = $config->{general}{rrd} if exists $config->{general}{rrd};
+   $rrd_virus = $config->{general}{rrd_virus} if exists $config->{general}{rrd_virus};
+
+   $xpoints = $config->{graphs}{xpoints} if exists $config->{graphs}{xpoints};
+}
+
 # prototypes
 sub daemonize();
 sub process_line($);
