Skip to content

Commit 18849a8

Browse files
authored
Include valkey 8 image changes to main (#17)
1 parent 91acd6b commit 18849a8

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

salami/valkey/8/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.5
1+
1.0.9

salami/valkey/8/rootfs/opt/salami/scripts/libvalkey.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,21 @@ valkey_conf_set() {
5757
value="$(trim_newlines_tabs "$value")"
5858
esc="$(_escape_sed "$value")"
5959

60+
# If value is empty and key is logfile, write logfile ""
61+
if [ "$key" = "logfile" ] && [ -z "$value" ]; then
62+
value='""'
63+
esc='""'
64+
fi
65+
6066
if [ "$key" = "save" ]; then
61-
# Multiple 'save' lines are allowed
6267
echo "$key $value" >> "${VALKEY_BASE_DIR}/etc/valkey.conf"
6368
else
64-
# replace_in_file <file> <match> <replace> <regex?>
65-
replace_in_file "${VALKEY_BASE_DIR}/etc/valkey.conf" "^#*[[:space:]]*${key}[[:space:]].*" "${key} ${esc}" false
69+
# If key exists, replace; else, append
70+
if grep -q -E "^[[:space:]]*$key[[:space:]]+" "${VALKEY_BASE_DIR}/etc/valkey.conf"; then
71+
replace_in_file "${VALKEY_BASE_DIR}/etc/valkey.conf" "^#*[[:space:]]*${key}[[:space:]].*" "${key} ${esc}" false
72+
else
73+
echo "${key} ${value}" >> "${VALKEY_BASE_DIR}/etc/valkey.conf"
74+
fi
6675
fi
6776
}
6877

@@ -338,6 +347,9 @@ valkey_append_include_conf() {
338347
#########################
339348
valkey_configure_default() {
340349
info "Initializing Valkey"
350+
echo "DEBUG: Writing config to $VALKEY_BASE_DIR/etc/valkey.conf"
351+
ls -l "$VALKEY_BASE_DIR/etc"
352+
341353

342354
rm -f "$VALKEY_BASE_DIR/tmp/valkey.pid"
343355

@@ -414,5 +426,8 @@ valkey_configure_default() {
414426
fi
415427

416428
valkey_append_include_conf
429+
echo "correct configuration:"
430+
cat "$VALKEY_BASE_DIR/etc/valkey.conf"
431+
cat "$VALKEY_BASE_DIR/etc/valkey-default.conf"
417432
fi
418433
}

0 commit comments

Comments
 (0)