1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
# Use the database access data created by dbconfig-common.
diff -Naur otrs-5.0.1.orig/Kernel/Config.pm.dist otrs-5.0.1/Kernel/Config.pm.dist
--- otrs-5.0.1.orig/Kernel/Config.pm.dist 2015-10-22 09:55:47.522492326 +0200
+++ otrs-5.0.1/Kernel/Config.pm.dist 2015-10-22 09:58:10.386055589 +0200
@@ -17,10 +17,24 @@
package Kernel::Config;
-use strict;
+#use strict;
use warnings;
use utf8;
+BEGIN {
+ if (-f '/etc/otrs/database.pm') {
+ require '/etc/otrs/database.pm';
+ if ($dbtype eq 'pgsql') {
+ $dbport ||= '5432';
+ our $dsn = "DBI:Pg:dbname";
+ }
+ else {
+ $dbport ||= '3306';
+ our $dsn = "DBI:mysql:database";
+ }
+ }
+}
+
sub Load {
my $Self = shift;
@@ -29,20 +43,20 @@
# ---------------------------------------------------- #
# The database host
- $Self->{DatabaseHost} = '127.0.0.1';
+ $Self->{DatabaseHost} = $dbserver || '127.0.0.1';
# The database name
- $Self->{Database} = 'otrs';
+ $Self->{Database} = $dbname || 'otrs';
# The database user
- $Self->{DatabaseUser} = 'otrs';
+ $Self->{DatabaseUser} = $dbuser || 'otrs';
# The password of database user. You also can use bin/otrs.Console.pl Maint::Database::PasswordCrypt
# for crypted passwords
- $Self->{DatabasePw} = 'some-pass';
+ $Self->{DatabasePw} = $dbpass || 'some-pass';
# The database DSN for MySQL ==> more: "perldoc DBD::mysql"
- $Self->{DatabaseDSN} = "DBI:mysql:database=$Self->{Database};host=$Self->{DatabaseHost};";
+ $Self->{DatabaseDSN} = "$dsn=$Self->{Database};host=$Self->{DatabaseHost};port=$dbport;";
# The database DSN for PostgreSQL ==> more: "perldoc DBD::Pg"
# if you want to use a local socket connection
|