summaryrefslogtreecommitdiff
path: root/LedgerSMB/Sysconfig.pm
blob: f8e1145ff2f92bd0046b164c0048722ba36b2afe (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 = (
  15. 'aa.pl', 'admin.pl', 'am.pl', 'ap.pl',
  16. 'ar.pl', 'arap.pl', 'arapprn.pl', 'bp.pl',
  17. 'ca.pl', 'cp.pl', 'ct.pl', 'gl.pl',
  18. 'hr.pl', 'ic.pl', 'io.pl', 'ir.pl',
  19. 'is.pl', 'jc.pl', 'login.pl', 'menu.pl',
  20. 'oe.pl', 'pe.pl', 'pos.pl', 'ps.pl',
  21. 'pw.pl', 'rc.pl', 'rp.pl'
  22. );
  23. # if you have latex installed set to 1
  24. $latex = 1;
  25. # spool directory for batch printing
  26. $spool = "spool";
  27. # path to user configuration files
  28. $userspath = "users";
  29. # templates base directory
  30. $templates = "templates";
  31. # Temporary files stored at"
  32. $tempdir = ( $ENV{TEMP} || '/tmp' );
  33. # Backup path
  34. $backuppath = $tempdir;
  35. # member file
  36. $memberfile = "users/members";
  37. # location of sendmail
  38. $sendmail = "/usr/sbin/sendmail -t";
  39. # SMTP settings
  40. $smtphost = '';
  41. $smtptimout = 60;
  42. # set language for login and admin
  43. $language = "";
  44. # Maximum number of invoices that can be printed on a check
  45. $check_max_invoices = 5;
  46. # program to use for file compression
  47. $gzip = "gzip -S .gz";
  48. # Path to the translation files
  49. $localepath = 'locale/po';
  50. # available printers
  51. %printer = (
  52. Laser => 'lpr -Plaser',
  53. Epson => 'lpr -PEpson',
  54. );
  55. my %config;
  56. read_config( 'ledgersmb.conf' => %config ) or die;
  57. # Root variables
  58. for $var (
  59. qw(pathsep logging check_max_invoices language session latex
  60. db_autoupdate)
  61. )
  62. {
  63. ${$var} = $config{''}{$var} if $config{''}{$var};
  64. }
  65. %printer = %{ $config{printers} } if $config{printers};
  66. # ENV Paths
  67. for $var (qw(PATH PERL5LIB)) {
  68. $ENV{$var} .= $pathsep . ( join $pathsep, @{ $config{environment}{$var} } )
  69. if $config{environment}{$var};
  70. }
  71. # Application-specific paths
  72. for $var (qw(localepath spool templates images)) {
  73. ${$var} = $config{paths}{$var} if $config{paths}{$var};
  74. }
  75. # Programs
  76. for $var (qw(gzip)) {
  77. ${$var} = $config{programs}{$var} if $config{programs}{$var};
  78. }
  79. # mail configuration
  80. for $var (qw(sendmail smpthost smtptimeout)) {
  81. ${$var} = $config{mail}{$var} if $config{mail}{$var};
  82. }
  83. # We used to have a global dbconnect but have moved to single entries
  84. for $var (qw(DBhost DBport DBname DBUserName DBPassword)) {
  85. ${ "global" . $var } = $config{globaldb}{$var} if $config{globaldb}{$var};
  86. }
  87. #putting this in an if clause for now so not to break other devel users
  88. if ( $config{globaldb}{DBname} ) {
  89. my $dbconnect = "dbi:Pg:dbname=$globalDBname host=$globalDBhost
  90. port=$globalDBport user=$globalDBUserName
  91. password=$globalDBPassword"; # for easier debugging
  92. $GLOBALDBH = DBI->connect($dbconnect);
  93. if ( !$GLOBALDBH ) {
  94. $form = new Form;
  95. $form->error("No GlobalDBH Configured or Could not Connect");
  96. }
  97. }
  98. # These lines prevent other apps in mod_perl from seeing the global db
  99. # connection info
  100. my $globalDBConnect = undef;
  101. my $globalUserName = undef;
  102. my $globalPassword = undef;
  103. 1;