2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

configDB.pm: add support for multiple hosts

using a single fhem installation (experimental)

git-svn-id: https://svn.fhem.de/fhem/trunk@11735 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2016-07-03 17:17:08 +00:00
parent d65281f846
commit df1080baca

View File

@ -114,6 +114,8 @@
# 2016-05-29 - changed improve support for postgresql (tnx to Matze)
# added configdb dump (for postgresql)
#
# 2016-07-03 - added support for multiple hosts (experimental)
#
##############################################################################
#
@ -121,6 +123,7 @@ use strict;
use warnings;
use Text::Diff;
use DBI;
use Sys::Hostname;
use Data::Dumper;
##################################################
@ -182,7 +185,26 @@ close(CONFIG);
use vars qw(%configDB);
my %dbconfig;
eval join("", @config);
##eval join("", @config);
## begin experimental
## support multiple hosts from one fhem installation
##
my $configs = join("",@config);
my @configs = split(/;/,$configs);
my $count = @configs;
if ($count > 1) {
my $fhemhost = hostname;
foreach my $c (@configs) {
eval $c;
last if ($dbconfig{fhemhost} eq $fhemhost);
}
} else {
eval $configs[0];
}
##
## end experimental
my $cfgDB_dbconn = $dbconfig{connection};
my $cfgDB_dbuser = $dbconfig{user};