From 5b4523b30d6c77f0972a9137b4015b73cd99121c Mon Sep 17 00:00:00 2001 From: MathieuJeandron Date: Mon, 17 Sep 2018 18:30:06 +0200 Subject: [PATCH] Correction of hostname when no user domainname MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit §{PublicAlbHostname} already contains protocol (see outputs from 03-publicalb.yaml) --- templates/04-web.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/templates/04-web.yaml b/templates/04-web.yaml index cd71d99..7e78ad4 100644 --- a/templates/04-web.yaml +++ b/templates/04-web.yaml @@ -593,14 +593,15 @@ Resources: 'dbcollation' => 'utf8mb4_unicode_ci', ); // Hostname definition // - $proto = 'https://'; $hostname = '${DomainName}'; if ($hostname == '') { - $proto = 'http://'; - $hostname = '${PublicAlbHostname}'; + $hostwithprotocol = '${PublicAlbHostname}'; } - $CFG->wwwroot = $proto . strtolower($hostname); - $CFG->sslproxy = ($proto == 'https://' ? true : false); + else { + $hostwithprotocol = ‘https://’ . strtolower($hostname); + } + $CFG->wwwroot = strtolower($hostwithprotocol); + $CFG->sslproxy = (substr($hostwithprotocol,0,5)==’https’ ? true : false); // Moodledata location // $CFG->dataroot = '/var/www/moodle/data'; $CFG->tempdir = '/var/www/moodle/temp';