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