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