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