Skip to content

Commit f2b6569

Browse files
committed
Support haproxy config.
1 parent 1892dec commit f2b6569

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

lib/SyTest/Homeserver/Synapse.pm

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,6 @@ sub start
153153
my $listeners = [ $self->generate_listeners ];
154154
my $bind_host = $self->{bind_host};
155155

156-
# run-tests.pl defines whether TLS should be used or not.
157-
our $WANT_TLS;
158-
my $public_baseurl = $WANT_TLS ?
159-
"https://${bind_host}:" . $self->secure_port() :
160-
"http://${bind_host}:" . $self->unsecure_port();
161-
162156
my $macaroon_secret_key = "secret_$port";
163157
my $registration_shared_secret = "reg_secret";
164158

@@ -177,7 +171,7 @@ sub start
177171
my $config_path = $self->{paths}{config} = $self->write_yaml_file( "config.yaml" => {
178172
server_name => $self->server_name,
179173
log_config => $log_config_file,
180-
public_baseurl => $public_baseurl,
174+
public_baseurl => $self->public_baseurl,
181175

182176
# We configure synapse to use a TLS cert which is signed by our dummy CA...
183177
tls_certificate_path => $self->{paths}{cert_file},
@@ -599,6 +593,16 @@ sub unsecure_port
599593
return $self->{ports}{synapse_unsecure};
600594
}
601595

596+
sub public_baseurl
597+
{
598+
my $self = shift;
599+
# run-tests.pl defines whether TLS should be used or not.
600+
our $WANT_TLS;
601+
return $WANT_TLS ?
602+
"https://$self->{bind_host}:" . $self->secure_port() :
603+
"http://$self->{bind_host}:" . $self->unsecure_port();
604+
}
605+
602606
package SyTest::Homeserver::Synapse::Direct;
603607
use base qw( SyTest::Homeserver::Synapse );
604608

@@ -1113,6 +1117,12 @@ sub unsecure_port
11131117
die "haproxy does not have an unsecure port mode\n";
11141118
}
11151119

1120+
sub public_baseurl
1121+
{
1122+
my $self = shift;
1123+
return "https://$self->{bind_host}:" . $self->secure_port();
1124+
}
1125+
11161126
sub start
11171127
{
11181128
my $self = shift;

0 commit comments

Comments
 (0)