summaryrefslogtreecommitdiff
path: root/LedgerSMB/Sysconfig.pm
blob: d16cb60a4f38ae355cbf43f3a9acafbda0797638 (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. $gzip = $config{programs}{gzip} if $config{programs}{gzip};
  66. $sendmail = $config{mail}{sendmail} if $config{mail}{sendmail};
  67. $smtphost = $config{mail}{smtphost} if $config{mail}{smtphost};
  68. $smtptimeout = $config{mail}{smtptimeout} if $config{mail}{smtptimeout};
  69. # We used to have a global dbconnect but have moved to single entries
  70. $globalDBhost = $config{globaldb}{DBhost} if $config{globaldb}{DBhost};
  71. $globalDBport = $config{globaldb}{DBport} if $config{globaldb}{DBport};
  72. $globalDBname = $config{globaldb}{DBname} if $config{globaldb}{DBname};
  73. $globalDBUserName = $config{globaldb}{DBUserName} if $config{globaldb}{DBUserName};
  74. $globalDBPassword = $config{globaldb}{DBPassword} if $config{globaldb}{DBPassword};
  75. #putting this in an if clause for now so not to break other devel users
  76. if ($config{globaldb}{DBname}){
  77. my $dbconnect = "dbi:Pg:dbname=$globalDBname host=$globalDBhost
  78. port=$globalDBport user=$globalDBUserName
  79. password=$globalDBPassword"; # for easier debugging
  80. $GLOBALDBH = DBI->connect($dbconnect);
  81. if (!$GLOBALDBH){
  82. $form = new Form;
  83. $form->error("No GlobalDBH Configured or Could not Connect");
  84. }
  85. }
  86. # These lines prevent other apps in mod_perl from seeing the global db
  87. # connection info
  88. my $globalDBConnect = undef;
  89. my $globalUserName = undef;
  90. my $globalPassword = undef;
  91. 1;