Browse Source

fix: [gitea,apache] correctly set ``https`` clone url when using ``https``.

framadate
Valentin Lab 5 years ago
parent
commit
df9ec0f849
  1. 7
      apache/lib/common
  2. 16
      apache/test/vhost_files
  3. 7
      gitea/hooks/web_proxy-relation-joined

7
apache/lib/common

@ -71,7 +71,14 @@ $(if [ "$custom_rules" ]; then
echo "- |"$'\n'"$(echo "$custom_rules" | prefix " ")"
fi)"
fi
relation-set protocol https
else
## Both services are available and different, don't do anything then ?
#relation-set protocol https
:
fi
else
relation-set protocol http
fi
vhost_statement=$(apache_vhost_statement "$PROTOCOLS") || return 1
echo "$vhost_statement"| file_put "$APACHE_CONFIG_LOCATION/$prefix$DOMAIN.conf" || return 1

16
apache/test/vhost_files

@ -94,7 +94,10 @@ export SERVICE_CONFIGSTORE='\$SERVICE_CONFIGSTORE'
DOMAIN=www.example.com
DOCKER_SITE_PATH=/var/www/\$DOMAIN
apache_vhost_create"
noerror
is errlvl 0
is err part "\
relation-set protocol:
| http"
is out reg '^file_put \$SERVICE_CONFIGSTORE/.*/www.example.com.conf'
try "
@ -107,6 +110,9 @@ ssl: true
apache_vhost_create"
is errlvl 0
is err part "## Auto-redirection from http to https"
is err part "\
relation-set protocol:
| https"
is out reg '^file_put \$SERVICE_CONFIGSTORE/.*/www.example.com.conf'
@ -127,6 +133,9 @@ ssl:
apache_vhost_create"
is errlvl 0
is err part "## Auto-redirection from http to https"
is err part "\
relation-set protocol:
| https"
is out part 'file_put $CONFIGSTORE/$BASE_SERVICE_NAME/etc/ssl/certs/www.example.com.pem
| c'
is out part 'file_put $CONFIGSTORE/$BASE_SERVICE_NAME/etc/ssl/private/www.example.com.key
@ -150,7 +159,10 @@ creds:
toto: xxx
'
apache_vhost_create"
noerror
is errlvl 0
is err part "\
relation-set protocol:
| http"
is out reg "htpasswd -bc '/etc/apache2/sites-enabled/www.example.com.passwd' 'toto' 'xxx'"
is out reg 'docker run -i --entrypoint /bin/bash .* docker/apache'

7
gitea/hooks/web_proxy-relation-joined

@ -5,7 +5,8 @@ set -e
. lib/common
DOMAIN=$(relation-get domain) || exit 1
PROTO=$(relation-get protocol) || true
PROTO=${PROTO:-https}
ini set server ROOT_URL "http://$DOMAIN/"
ini set server SSH_DOMAIN "$DOMAIN"
ini set server ROOT_URL "$PROTO://$DOMAIN/"
ini set server SSH_DOMAIN "$DOMAIN"
Loading…
Cancel
Save