You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

40 lines
1.2 KiB

#!/bin/bash
## Should be executable N time in a row with same result.
. lib/common
set -e
## if I'm not linked to a cyclos-server, then complain
if read-0 ts _ _ < <(get_service_relation "$SERVICE_NAME" "cyclos-server"); then
debug "cyclos-server relation fullfilled"
if read-0 wps wpcfg _ < <(get_service_relation "$ts" "web-proxy"); then
debug "found web-proxy relation"
else
## XXXvlab: relation dependence as this one could actually be implemented in compose-core
err "cyclos-server relation requires the server to have a web-proxy relation to be set"
exit 1
fi
web_proxy_relation_dir=$(get_relation_data_dir "$ts" "$wps" "web-proxy") || {
err "Failed to find relation file"
exit 1
}
web_proxy_relation_config=$(cat "$web_proxy_relation_dir/data") || exit 2
url=$(e "$web_proxy_relation_config" | shyaml get-value url) || {
err "Couldn't get domain information in ${DARKCYAN}web-proxy${NORMAL} relation's data."
exit 1
}
if ! cyclos_ui.conf_add "apiRoot: $url/api"; then
err "Couldn't configure api root correctly."
exit 1
fi
fi
cyclos_ui.generate_website