summaryrefslogtreecommitdiff
path: root/LedgerSMB/Sysconfig.pm
blob: 6474dfd6024cbcefdb2f66e87e3b0dab7e4ed8e7 (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. $ENV{PATH} .= $pathsep . ( join $pathsep, @{ $config{environment}{PATH} } )
  66. if $config{environment}{PATH};
  67. $ENV{PERL5LIB} .= ":" . ( join ':', @{ $config{environment}{PERL5LIB} } )
  68. if $config{environment}{PERL5LIB};
  69. %printer = %{ $config{printers} } if $config{printers};
  70. $localepath = $config{paths}{localepath} if $config{paths}{localepath};
  71. $spool = $config{paths}{spool} if $config{paths}{spool};
  72. $templates = $config{paths}{templates} if $config{paths}{templates};
  73. $tempdir = $config{paths}{tempdir} if $config{paths}{tempdir};
  74. $userspath =
  75. ( $config{paths}{userspath} ) ? $config{paths}{userspath} : $tempdir;
  76. $gzip = $config{programs}{gzip} if $config{programs}{gzip};
  77. $sendmail = $config{mail}{sendmail} if $config{mail}{sendmail};
  78. $smtphost = $config{mail}{smtphost} if $config{mail}{smtphost};
  79. $smtptimeout = $config{mail}{smtptimeout} if $config{mail}{smtptimeout};
  80. # We used to have a global dbconnect but have moved to single entries
  81. $globalDBhost = $config{globaldb}{DBhost} if $config{globaldb}{DBhost};
  82. $globalDBport = $config{globaldb}{DBport} if $config{globaldb}{DBport};
  83. $globalDBname = $config{globaldb}{DBname} if $config{globaldb}{DBname};
  84. $globalDBUserName = $config{globaldb}{DBUserName}
  85. if $config{globaldb}{DBUserName};
  86. $globalDBPassword = $config{globaldb}{DBPassword}
  87. if $config{globaldb}{DBPassword};
  88. #putting this in an if clause for now so not to break other devel users
  89. if ( $config{globaldb}{DBname} ) {
  90. my $dbconnect = "dbi:Pg:dbname=$globalDBname host=$globalDBhost
  91. port=$globalDBport user=$globalDBUserName
  92. password=$globalDBPassword"; # for easier debugging
  93. $GLOBALDBH = DBI->connect($dbconnect);
  94. if ( !$GLOBALDBH ) {
  95. $form = new Form;
  96. $form->error("No GlobalDBH Configured or Could not Connect");
  97. }
  98. $GLOBALDBH->{pg_enable_utf8} = 1;
  99. }
  100. # These lines prevent other apps in mod_perl from seeing the global db
  101. # connection info
  102. my $globalDBConnect = undef;
  103. my $globalUserName = undef;
  104. my $globalPassword = undef;
  105. 1;