forked from 0k/0k-charms
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.
39 lines
992 B
39 lines
992 B
# -*- mode: shell-script -*-
|
|
|
|
CONFIG_FILE=/etc/docker/registry/config.yml
|
|
HOST_CONFIG_FILE="$SERVICE_CONFIGSTORE$CONFIG_FILE"
|
|
|
|
ini_merge_str() {
|
|
local cfg="$1" \
|
|
cache_file="$CACHEDIR/$FUNCNAME.cache.$(p0 "$@" "$(cat "$HOST_CONFIG_FILE")" | md5_compat)" \
|
|
result
|
|
if [ -z "$cfg" ]; then
|
|
return 0
|
|
fi
|
|
if [ -e "$cache_file" ]; then
|
|
#debug "$FUNCNAME: SESSION cache hit $1"
|
|
cat "$cache_file" || return 1
|
|
return 0
|
|
fi
|
|
|
|
result="$(merge_yaml_str "$(cat "$HOST_CONFIG_FILE")" "$cfg")" || return 1
|
|
e "$result" | tee "$cache_file" || return 1
|
|
}
|
|
|
|
|
|
ini_merge() {
|
|
local result
|
|
result=$(ini_merge_str "$(cat -)")
|
|
e "$result" > "$HOST_CONFIG_FILE"
|
|
}
|
|
|
|
|
|
registry_config_hash() {
|
|
debug "Adding config hash to enable recreating upon config change."
|
|
config_hash=$(cat "$HOST_CONFIG_FILE" | md5_compat) || exit 1
|
|
init-config-add "
|
|
$MASTER_BASE_SERVICE_NAME:
|
|
labels:
|
|
- compose.config_hash=$config_hash
|
|
"
|
|
}
|