Browse Source

new: dev: [apache] support when called out from a relation.

This is to support ``ssh-tunnel`` that will be called from ``init``.
framadate
Valentin Lab 6 years ago
parent
commit
38990109f5
  1. 8
      apache/lib/common
  2. 1
      apache/test/vhost_cert_provider
  3. 1
      apache/test/vhost_files

8
apache/lib/common

@ -56,7 +56,9 @@ apache_vhost_create() {
protocols=$(__vhost_cfg_normalize_protocol "$cfg") || return 1 protocols=$(__vhost_cfg_normalize_protocol "$cfg") || return 1
fi fi
domain=$(get_domain "$cfg") && relation-set domain "$domain"
domain=$(get_domain "$cfg") && {
[ "$RELATION_DATA_FILE" ] && relation-set domain "$domain"
}
if is_protocol_enabled https "$protocols"; then if is_protocol_enabled https "$protocols"; then
if [ -z "$domain" ]; then if [ -z "$domain" ]; then
@ -80,6 +82,7 @@ apache_vhost_create() {
RewriteCond %{HTTPS} off RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L,QSA] RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L,QSA]
" "
[ "$RELATION_DATA_FILE" ] && \
relation-set apache-custom-rules "$redirect_rule relation-set apache-custom-rules "$redirect_rule
$(if [ "$custom_rules" ]; then $(if [ "$custom_rules" ]; then
echo "- |"$'\n'"$(echo "$custom_rules" | prefix " ")" echo "- |"$'\n'"$(echo "$custom_rules" | prefix " ")"
@ -89,13 +92,16 @@ $(if [ "$custom_rules" ]; then
echo "- |"$'\n'"$(echo "$custom_rules" | prefix " ")" echo "- |"$'\n'"$(echo "$custom_rules" | prefix " ")"
fi)")") fi)")")
fi fi
[ "$RELATION_DATA_FILE" ] && \
relation-set protocol https relation-set protocol https
else else
## Both services are available and different, don't do anything then ? ## Both services are available and different, don't do anything then ?
#[ "$RELATION_DATA_FILE" ] && \
# relation-set protocol https # relation-set protocol https
: :
fi fi
else else
[ "$RELATION_DATA_FILE" ] && \
relation-set protocol http relation-set protocol http
fi fi
vhost_statement=$(apache_vhost_statement "$type" "$protocols" "$cfg" "$domain") || { vhost_statement=$(apache_vhost_statement "$type" "$protocols" "$cfg" "$domain") || {

1
apache/test/vhost_cert_provider

@ -24,6 +24,7 @@ relation-get() {
} }
export -f relation-get export -f relation-get
export RELATION_DATA_FILE=x
relation-set() { relation-set() {
local key="$1" value="$2" local key="$1" value="$2"
echo "relation-set $key:" >&2 echo "relation-set $key:" >&2

1
apache/test/vhost_files

@ -22,6 +22,7 @@ relation-get() {
} }
export -f relation-get export -f relation-get
export RELATION_DATA_FILE=x
relation-set() { relation-set() {
local key="$1" value="$2" local key="$1" value="$2"
echo "relation-set $key:" >&2 echo "relation-set $key:" >&2

Loading…
Cancel
Save