summaryrefslogtreecommitdiff
path: root/LedgerSMB/Sysconfig.pm
blob: 2c66a75f5dc54cdb49d9591b7b5e44ccdcf07c8a (plain)
  1. #  This is the new configuration file for LedgerSMB. Eventually all system
  2. # configuration directives will go here, This will probably not fully replace
  3. # the ledgersmb.conf until 1.3, however.
  4. package LedgerSMB::Sysconfig;
  5. use LedgerSMB::Form;
  6. use Config::Std;
  7. use DBI qw(:sql_types);
  8. # For Win32, change $pathsep to ';';
  9. $pathsep=':';
  10. $session='DB';
  11. $logging=0; # No logging on by default
  12. @io_lineitem_columns = qw(unit onhand sellprice discount linetotal);
  13. # Whitelist for redirect destination
  14. @scripts = ('aa.pl', 'admin.pl', 'am.pl', 'ap.pl', 'ar.pl', 'arap.pl',
  15. 'arapprn.pl', 'bp.pl', 'ca.pl', 'cp.pl', 'ct.pl', 'gl.pl', 'hr.pl',
  16. 'ic.pl', 'io.pl', 'ir.pl', 'is.pl', 'jc.pl', 'login.pl', 'menu.pl',
  17. 'oe.pl', 'pe.pl', 'pos.pl', 'ps.pl', 'pw.pl', 'rc.pl', 'rp.pl');
  18. # if you have latex installed set to 1
  19. $latex = 1;
  20. # spool directory for batch printing
  21. $spool = "spool";
  22. # path to user configuration files
  23. $userspath = "users";
  24. # templates base directory
  25. $templates = "templates";
  26. # Temporary files stored at"
  27. $tempdir = ($ENV{TEMP} || '/tmp');
  28. # member file
  29. $memberfile = "users/members";
  30. # location of sendmail
  31. $sendmail = "/usr/sbin/sendmail -t";
  32. # SMTP settings
  33. $smtphost = '';
  34. $smtptimout = 60;
  35. # set language for login and admin
  36. $language = "";
  37. # Maximum number of invoices that can be printed on a check
  38. $check_max_invoices = 5;
  39. # program to use for file compression
  40. $gzip = "gzip -S .gz";
  41. # Path to the translation files
  42. $localepath = 'locale/po';
  43. # available printers
  44. %printer = ( Laser => 'lpr -Plaser',
  45. Epson => 'lpr -PEpson',
  46. );
  47. my %config;
  48. read_config('ledgersmb.conf' => %config) or die;
  49. # We should clean this code up for 1.3 :-) Chris T.
  50. $logging = $config{''}{logging} if $config{''}{logging};
  51. $check_max_invoices = $config{''}{check_max_invoices} if
  52. $config{''}{check_max_invoices};
  53. $language = $config{''}{language} if $config{''}{language};
  54. $session = $config{''}{session} if $config{''}{session};
  55. $latex = $config{''}{latex} if $config{''}{latex};
  56. $ENV{PATH} .= $pathsep.(join $pathsep, @{$config{environment}{PATH}}) if
  57. $config{environment}{PATH};
  58. $ENV{PERL5LIB} .= ":".(join ':', @{$config{environment}{PERL5LIB}}) if
  59. $config{environment}{PERL5LIB};
  60. %printer = %{$config{printers}} if $config{printers};
  61. $localepath = $config{paths}{localepath} if $config{paths}{localepath};
  62. $spool = $config{paths}{spool} if $config{paths}{spool};
  63. $templates = $config{paths}{templates} if $config{paths}{templates};
  64. $tempdir = $config{paths}{tempdir} if $config{paths}{tempdir};
  65. $userspath = ($config{paths}{userspath})
  66. ? $config($config{paths}{userspath}) : $tempdir;
  67. $gzip = $config{programs}{gzip} if $config{programs}{gzip};
  68. $sendmail = $config{mail}{sendmail} if $config{mail}{sendmail};
  69. $smtphost = $config{mail}{smtphost} if $config{mail}{smtphost};
  70. $smtptimeout = $config{mail}{smtptimeout} if $config{mail}{smtptimeout};
  71. # We used to have a global dbconnect but have moved to single entries
  72. $globalDBhost = $config{globaldb}{DBhost} if $config{globaldb}{DBhost};
  73. $globalDBport = $config{globaldb}{DBport} if $config{globaldb}{DBport};
  74. $globalDBname = $config{globaldb}{DBname} if $config{globaldb}{DBname};
  75. $globalDBUserName = $config{globaldb}{DBUserName} if $config{globaldb}{DBUserName};
  76. $globalDBPassword = $config{globaldb}{DBPassword} if $config{globaldb}{DBPassword};
  77. #putting this in an if clause for now so not to break other devel users
  78. if ($config{globaldb}{DBname}){
  79. my $dbconnect = "dbi:Pg:dbname=$globalDBname host=$globalDBhost
  80. port=$globalDBport user=$globalDBUserName
  81. password=$globalDBPassword"; # for easier debugging
  82. $GLOBALDBH = DBI->connect($dbconnect);
  83. if (!$GLOBALDBH){
  84. $form = new Form;
  85. $form->error("No GlobalDBH Configured or Could not Connect");
  86. }
  87. }
  88. # These lines prevent other apps in mod_perl from seeing the global db
  89. # connection info
  90. my $globalDBConnect = undef;
  91. my $globalUserName = undef;
  92. my $globalPassword = undef;
  93. 1;