summaryrefslogtreecommitdiff
path: root/LedgerSMB/Sysconfig.pm
blob: b2fc1a93c85248bf3b3a4166513540b518db9527 (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. # Defaults to 1 megabyte
  29. $max_post_size = 1024 * 1024;
  30. # defaults to 2-- default number of places to round amounts to
  31. $decimal_places = 2;
  32. # defaults to LedgerSMB-1.3 - default spelling of cookie
  33. $cookie_name = "LedgerSMB-1.3";
  34. # spool directory for batch printing
  35. $spool = "spool";
  36. # path to user configuration files
  37. $userspath = "users";
  38. # templates base directory
  39. $templates = "templates";
  40. # Temporary files stored at"
  41. $tempdir = ( $ENV{TEMP} || '/tmp' );
  42. # Backup path
  43. $backuppath = $tempdir;
  44. # member file
  45. $memberfile = "users/members";
  46. # location of sendmail
  47. $sendmail = "/usr/sbin/sendmail -t";
  48. # SMTP settings
  49. $smtphost = '';
  50. $smtptimout = 60;
  51. # set language for login and admin
  52. $language = "";
  53. # Maximum number of invoices that can be printed on a check
  54. $check_max_invoices = 5;
  55. # program to use for file compression
  56. $gzip = "gzip -S .gz";
  57. # Path to the translation files
  58. $localepath = 'locale/po';
  59. # available printers
  60. %printer = (
  61. Laser => 'lpr -Plaser',
  62. Epson => 'lpr -PEpson',
  63. );
  64. my %config;
  65. read_config( 'ledgersmb.conf' => %config ) or die;
  66. # Root variables
  67. for $var (
  68. qw(pathsep logging check_max_invoices language auth latex
  69. db_autoupdate force_username_case max_post_size decimal_places cookie_name)
  70. )
  71. {
  72. ${$var} = $config{''}{$var} if $config{''}{$var};
  73. }
  74. %printer = %{ $config{printers} } if $config{printers};
  75. # ENV Paths
  76. for $var (qw(PATH PERL5LIB)) {
  77. if (ref $config{environment}{$var} eq 'ARRAY') {
  78. $ENV{$var} .= $pathsep . ( join $pathsep, @{ $config{environment}{$var} } );
  79. } elsif ($config{environment}{$var}) {
  80. $ENV{$var} .= $pathsep . $config{environment}{$var};
  81. }
  82. }
  83. # Application-specific paths
  84. for $var (qw(localepath spool templates images)) {
  85. ${$var} = $config{paths}{$var} if $config{paths}{$var};
  86. }
  87. # Programs
  88. for $var (qw(gzip)) {
  89. ${$var} = $config{programs}{$var} if $config{programs}{$var};
  90. }
  91. # mail configuration
  92. for $var (qw(sendmail smtphost smtptimeout)) {
  93. ${$var} = $config{mail}{$var} if $config{mail}{$var};
  94. }
  95. # We used to have a global dbconnect but have moved to single entries
  96. for $var (qw(DBhost DBport DBname DBUserName DBPassword)) {
  97. ${ "global" . $var } = $config{globaldb}{$var} if $config{globaldb}{$var};
  98. }
  99. #putting this in an if clause for now so not to break other devel users
  100. #if ( $config{globaldb}{DBname} ) {
  101. # my $dbconnect = "dbi:Pg:dbname=$globalDBname host=$globalDBhost
  102. # port=$globalDBport user=$globalDBUserName
  103. # password=$globalDBPassword"; # for easier debugging
  104. # $GLOBALDBH = DBI->connect($dbconnect);
  105. # if ( !$GLOBALDBH ) {
  106. # $form = new Form;
  107. # $form->error("No GlobalDBH Configured or Could not Connect");
  108. # }
  109. # $GLOBALDBH->{pg_enable_utf8} = 1;
  110. #}
  111. # These lines prevent other apps in mod_perl from seeing the global db
  112. # connection info
  113. $ENV{PGHOST} = $config{database}{host};
  114. $ENV{PGPORT} = $config{database}{port};
  115. our $default_db = $config{database}{default_db};
  116. our $db_namespace = $config{database}{db_namespace};
  117. 1;