summaryrefslogtreecommitdiff
path: root/LedgerSMB/Sysconfig.pm
blob: ed27c17659408719c7a036e90470ef5b20268029 (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. $auth = '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 auth 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. if (ref $config{environment}{$var} eq 'ARRAY') {
  71. $ENV{$var} .= $pathsep . ( join $pathsep, @{ $config{environment}{$var} } );
  72. } elsif ($config{environment}{$var}) {
  73. $ENV{$var} .= $pathsep . $config{environment}{$var};
  74. }
  75. }
  76. # Application-specific paths
  77. for $var (qw(localepath spool templates images)) {
  78. ${$var} = $config{paths}{$var} if $config{paths}{$var};
  79. }
  80. # Programs
  81. for $var (qw(gzip)) {
  82. ${$var} = $config{programs}{$var} if $config{programs}{$var};
  83. }
  84. # mail configuration
  85. for $var (qw(sendmail smtphost smtptimeout)) {
  86. ${$var} = $config{mail}{$var} if $config{mail}{$var};
  87. }
  88. # We used to have a global dbconnect but have moved to single entries
  89. for $var (qw(DBhost DBport DBname DBUserName DBPassword)) {
  90. ${ "global" . $var } = $config{globaldb}{$var} if $config{globaldb}{$var};
  91. }
  92. #putting this in an if clause for now so not to break other devel users
  93. #if ( $config{globaldb}{DBname} ) {
  94. # my $dbconnect = "dbi:Pg:dbname=$globalDBname host=$globalDBhost
  95. # port=$globalDBport user=$globalDBUserName
  96. # password=$globalDBPassword"; # for easier debugging
  97. # $GLOBALDBH = DBI->connect($dbconnect);
  98. # if ( !$GLOBALDBH ) {
  99. # $form = new Form;
  100. # $form->error("No GlobalDBH Configured or Could not Connect");
  101. # }
  102. # $GLOBALDBH->{pg_enable_utf8} = 1;
  103. #}
  104. # These lines prevent other apps in mod_perl from seeing the global db
  105. # connection info
  106. $ENV{PGHOST} = $config{database}{host};
  107. $ENV{PGPORT} = $config{database}{port};
  108. our $default_db = $config{database}{default_db};
  109. our $db_namespace = $config{database}{db_namespace};
  110. 1;