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