fork 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

  1. # -*- mode: shell-script -*-
  2. CONFIG_FILE=/etc/docker/registry/config.yml
  3. HOST_CONFIG_FILE="$SERVICE_CONFIGSTORE$CONFIG_FILE"
  4. ini_merge_str() {
  5. local cfg="$1" \
  6. cache_file="$CACHEDIR/$FUNCNAME.cache.$(p0 "$@" "$(cat "$HOST_CONFIG_FILE")" | md5_compat)" \
  7. result
  8. if [ -z "$cfg" ]; then
  9. return 0
  10. fi
  11. if [ -e "$cache_file" ]; then
  12. #debug "$FUNCNAME: SESSION cache hit $1"
  13. cat "$cache_file" || return 1
  14. return 0
  15. fi
  16. result="$(merge_yaml_str "$(cat "$HOST_CONFIG_FILE")" "$cfg")" || return 1
  17. e "$result" | tee "$cache_file" || return 1
  18. }
  19. ini_merge() {
  20. local result
  21. result=$(ini_merge_str "$(cat -)")
  22. e "$result" > "$HOST_CONFIG_FILE"
  23. }
  24. registry_config_hash() {
  25. debug "Adding config hash to enable recreating upon config change."
  26. config_hash=$(cat "$HOST_CONFIG_FILE" | md5_compat) || exit 1
  27. init-config-add "
  28. $MASTER_BASE_SERVICE_NAME:
  29. labels:
  30. - compose.config_hash=$config_hash
  31. "
  32. }