summaryrefslogtreecommitdiff
path: root/LedgerSMB/Sysconfig.pm
blob: ef91c45d2efc50ff17d5f0c0247ee735a61a57e8 (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. # member file
  27. $memberfile = "users/members";
  28. # location of sendmail
  29. $sendmail = "/usr/sbin/sendmail -t";
  30. # SMTP settings
  31. $smtphost = '';
  32. $smtptimout = 60;
  33. # set language for login and admin
  34. $language = "";
  35. # Maximum number of invoices that can be printed on a check
  36. $check_max_invoices = 5;
  37. # program to use for file compression
  38. $gzip = "gzip -S .gz";
  39. # Path to the translation files
  40. $localepath = 'locale/po';
  41. # available printers
  42. %printer = ( Laser => 'lpr -Plaser',
  43. Epson => 'lpr -PEpson',
  44. );
  45. my %config;
  46. read_config('ledgersmb.conf' => %config) or die;
  47. $logging = $config{''}{logging} if $config{''}{logging};
  48. $check_max_invoices = $config{''}{check_max_invoices} if
  49. $config{''}{check_max_invoices};
  50. $language = $config{''}{language} if $config{''}{language};
  51. $session = $config{''}{session} if $config{''}{session};
  52. $latex = $config{''}{latex} if $config{''}{latex};
  53. $ENV{PATH} .= $pathsep.(join $pathsep, @{$config{environment}{PATH}}) if
  54. $config{environment}{PATH};
  55. $ENV{PERL5LIB} .= ":".(join ':', @{$config{environment}{PERL5LIB}}) if
  56. $config{environment}{PERL5LIB};
  57. %printer = %{$config{printers}} if $config{printers};
  58. $localepath = $config{paths}{localepath} if $config{paths}{localepath};
  59. $spool = $config{paths}{spool} if $config{paths}{spool};
  60. $templates = $config{paths}{templates} if $config{paths}{templates};
  61. $gzip = $config{programs}{gzip} if $config{programs}{gzip};
  62. $sendmail = $config{mail}{sendmail} if $config{mail}{sendmail};
  63. $smtphost = $config{mail}{smtphost} if $config{mail}{smtphost};
  64. $smtptimeout = $config{mail}{smtptimeout} if $config{mail}{smtptimeout};
  65. # We used to have a global dbconnect but have moved to single entries
  66. $globalDBhost = $config{globaldb}{DBhost} if $config{globaldb}{DBhost};
  67. $globalDBport = $config{globaldb}{DBport} if $config{globaldb}{DBport};
  68. $globalDBname = $config{globaldb}{DBname} if $config{globaldb}{DBname};
  69. $globalDBUserName = $config{globaldb}{DBUserName} if $config{globaldb}{DBUserName};
  70. $globalDBPassword = $config{globaldb}{DBPassword} if $config{globaldb}{DBPassword};
  71. #putting this in an if clause for now so not to break other devel users
  72. if ($config{globaldb}{DBname}){
  73. my $dbconnect = "dbi:Pg:dbname=$globalDBname host=$globalDBhost
  74. port=$globalDBport user=$globalDBUserName
  75. password=$globalDBPassword"; # for easier debugging
  76. $GLOBALDBH = DBI->connect($dbconnect);
  77. if (!$GLOBALDBH){
  78. $form = new Form;
  79. $form->error("No GlobalDBH Configured or Could not Connect");
  80. }
  81. }
  82. # These lines prevent other apps in mod_perl from seeing the global db
  83. # connection info
  84. my $globalDBConnect = undef;
  85. my $globalUserName = undef;
  86. my $globalPassword = undef;
  87. 1;