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