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