From 016299e1896d256b9a42077af147e4dc8f150578 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Sun, 4 Jun 2023 12:09:14 +0200 Subject: [PATCH] fix: [minecraft] reload when any configuration changes --- minecraft/hooks/init | 3 +++ minecraft/lib/common | 11 +++++++++++ 2 files changed, 14 insertions(+) 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 +" +}