summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow (europa) <paul@buetow.org>2015-07-24 23:53:06 +0100
committerPaul Buetow (europa) <paul@buetow.org>2015-07-24 23:53:06 +0100
commita5f6484478072e359834bb1b83a29cf4dcd2539c (patch)
tree952adc4388825fb545e5e784e5a2dd06bdee229a
parentde8b70c1a5b46b0e0e375d364cd714aaaadf7f9b (diff)
introducing host aliasing
-rw-r--r--Xerl/Setup/Configure.pm18
1 files changed, 14 insertions, 4 deletions
diff --git a/Xerl/Setup/Configure.pm b/Xerl/Setup/Configure.pm
index bdd23b9..dfacc1d 100644
--- a/Xerl/Setup/Configure.pm
+++ b/Xerl/Setup/Configure.pm
@@ -64,8 +64,9 @@ sub defaults {
$self->set_hostname( lc $hostname )
unless $self->hostname_exists();
- unless ( -d $self->get_hostroot() . $self->get_host() ) {
- my $redirect = $self->get_hostroot() . 'redirect:' . $self->get_host();
+ my $host = $self->get_host();
+ unless ( -d $self->get_hostroot() . $host ) {
+ my $redirect = $self->get_hostroot() . 'redirect:' . $host;
if ( -f $redirect ) {
my $file = Xerl::Tools::FileIO->new( 'path' => $redirect );
@@ -76,13 +77,22 @@ sub defaults {
$self->set_finish_request(1);
}
- my $alias = $self->get_hostroot() . 'alias:' . $self->get_host();
+ my $alias = $self->get_hostroot() . 'alias:' . $host;
+ my $alias_host = '';
+
+ unless ( -f $alias ) {
+ my ($hostname, @domain) = split /\./, $host;
+ my $domain = join '.', @domain;
+ $alias = $self->get_hostroot() . 'alias:' . $domain;
+ $alias_host = "$hostname.";
+ }
if ( -f $alias ) {
my $file = Xerl::Tools::FileIO->new( 'path' => $alias );
+ $alias_host .= $file->shift();
$file->fslurp();
- $self->set_host( $file->shift() );
+ $self->set_host( $alias_host );
}
}