[Yapcom checkin] rev 53 - / db lib/YAPC

[prev] [thread] [next] [lurker] [Date index for 2003/11/26]

From: svn
Subject: [Yapcom checkin] rev 53 - / db lib/YAPC
Date: 11:56 on 26 Nov 2003
Author: jon
Date: 2003-11-26 11:56:24 +0200 (Wed, 26 Nov 2003)
New Revision: 53

Added:
   db/
   db/config.sample
Modified:
   lib/YAPC/Config.pm
Log:
add config file

Added: db/config.sample
===================================================================
--- db/config.sample	2003-11-26 09:55:03 UTC (rev 52)
+++ db/config.sample	2003-11-26 09:56:24 UTC (rev 53)
@@ -0,0 +1,3 @@
+SITE_DIR = /home/yehuda/Yapcom
+SITE_EMAIL = jon@xxxxxx.xx.xx
+SITE_ADMINS = jon@xxxxxx.xx.xx 

Modified: lib/YAPC/Config.pm
===================================================================
--- lib/YAPC/Config.pm	2003-11-26 09:55:03 UTC (rev 52)
+++ lib/YAPC/Config.pm	2003-11-26 09:56:24 UTC (rev 53)
@@ -1,28 +1,32 @@
 package YAPC::Config;
+use FindBin;
 use strict;
 use warnings;
 our (@STORAGE, $dir, $db_dir, $db_file, $TIMEOUT, $templates_dir, $email_address);
 our (@proposal_languages, @proposal_lengths, @admins);
 
-$dir = "/home/gabor/projects/perl/perl.org.il/YAPC/dev";
-$email_address = 'yapc@xxxx.xxx.xx';
+my %config;
+if (open CONFIG, "$FindBin::Bin/../db/config") {
+	local $/ = undef;
+	%config = split(/\s*=\s*|\s*[\r\n]+\s*/, <CONFIG>);
+	close CONFIG;
+}
 
+$dir = $config{'SITE_DIR'} || "/home/gabor/projects/perl/perl.org.il/YAPC/dev";
+$email_address = $config{'SITE_EMAIL'} || 'yapc@xxxx.xxx.xx';
+
 # list of e-mail address of administrators whom will have extra rights
-#@admins = qw(gabor@xxxx.xxx.xx); 
+@admins = ($config{'SITE_ADMIN'}) ? split /[\s,]+/, $config{'SITE_ADMIN'} :  qw(gabor@xxx.xx.xx);
 
-
 $db_dir = "$dir/db";
 $db_file="$db_dir/yapc.db";
-@STORAGE   = ("dbi:SQLite:$db_file", 'root', undef);
-$TIMEOUT = 100;
+@STORAGE = ("dbi:SQLite:$db_file", 'root', undef);
+$TIMEOUT = $config{'DB_TIMEOUT'} || 100;
 $templates_dir = "$dir/templates";
 
+@proposal_lengths = ($config{'PROPOSAL_LENGTHS'}) ? split /[\s,]+/, $config{'PROPOSAL_LENGTHS'} : (5, 30, 60, 90, 180);
+@proposal_languages = ($config{'PROPOSAL_LANGUAGES'}) ? split /[\s,]+/, $config{'PROPOSAL_LANGUAGES'} : qw(English Hebrew);
 
-@proposal_lengths = (5, 30, 60, 90, 180);
-@proposal_languages = qw(English Hebrew);
-
-@admins = qw(gabor@xxx.xx.xx);
-
 1;
 
 =head1 VERSION

Generated at 12:06 on 26 Nov 2003 by mariachi 0.51