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