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