diff --git a/minecraft/hooks/init b/minecraft/hooks/init index a050204..c4c3193 100755 --- a/minecraft/hooks/init +++ b/minecraft/hooks/init @@ -40,3 +40,6 @@ ops=$(options-get ops) || true minecraft:make-ops "$ops" minecraft:make-properties "$properties" + +service_def=$(get_compose_service_def "$SERVICE_NAME") || exit 1 +minecraft:config-hash "$service_def" \ No newline at end of file diff --git a/minecraft/lib/common b/minecraft/lib/common index b408405..6777398 100644 --- a/minecraft/lib/common +++ b/minecraft/lib/common @@ -74,3 +74,14 @@ minecraft:make-properties() { } > "$SERVICE_DATASTORE/${MINECRAFT_DATA}/server.properties" } + +minecraft:config-hash() { + local opts="$1" + debug "Adding config hash to enable recreating upon config change." + config_hash=$(e "$opts" | md5_compat) || exit 1 + init-config-add " +$SERVICE_NAME: + labels: + - compose.config_hash=$config_hash +" +}