Skip to content

Commit

Permalink
[Enhancement] Add config file prefix variable #249 (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
GioF71 authored Dec 18, 2023
1 parent 2d2e2dd commit f8663c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ SQUEEZELITE_LOG_CATEGORY_STREAM|-d|Support for log level on category `stream`
SQUEEZELITE_LOG_CATEGORY_DECODE|-d|Support for log level on category `decode`
SQUEEZELITE_LOG_CATEGORY_OUTPUT|-d|Support for log level on category `output`
SQUEEZELITE_LOG_CATEGORY_IR|-d|Support for log level on category `ir`
CONFIG_FILE_PREFIX||Prefix for files in volume `/config`
STARTUP_DELAY_SEC||Delay before starting the application, defaults to `0`

It is possible to add and additional preset configuration file using the volume `/app/assets/additional-presets.conf`.
Expand All @@ -127,7 +128,7 @@ Possible values for variables `SQUEEZELITE_LOG_CATEGORY_*` are `info`, `debug` o

### Automatic MAC address creation

If you don't provide a value to `SQUEEZELITE_MAC_ADDRESS`, a random mac address will be generated and stored (if possible) under `/config/mac-address.txt`, so it will be reloaded on next restart.
If you don't provide a value to `SQUEEZELITE_MAC_ADDRESS`, a random mac address will be generated and stored (if possible) under `/config/mac-address.txt`, so it will be reloaded on next restart. The file name can be prepended by the optional `CONFIG_FILE_PREFIX`.
Use a persistent volume in order to preserve the functionality in the event of container recreation (such as when you update to a newer image).

## Volumes
Expand Down
12 changes: 9 additions & 3 deletions app/bin/cmd-line-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,16 @@ function cmdline-rates() {

function handle_mac_address() {
if [[ -z "${SQUEEZELITE_MAC_ADDRESS}" ]]; then
FILE_NAME=mac-address.txt
if [[ -n "${CONFIG_FILE_PREFIX}" ]]; then
FILE_NAME=${CONFIG_FILE_PREFIX}-${FILE_NAME}
fi
FILE_PATH="/config/${FILE_NAME}"
echo "File name for mac-address is [$FILE_PATH]"
echo "No mac address, specified, try loading ..."
if [ -f "/config/mac-address.txt" ]; then
if [ -f $FILE_PATH ]; then
echo "Found file with mac address ..."
mac=`cat /config/mac-address.txt`
mac=`cat $FILE_PATH`
echo "Mac address is ${mac}"
SQUEEZELITE_MAC_ADDRESS="${mac}"
else
Expand All @@ -174,7 +180,7 @@ function handle_mac_address() {
SQUEEZELITE_MAC_ADDRESS="${mac}"
# write if possible
if [ -w /config ]; then
echo "${mac}" > /config/mac-address.txt
echo "${mac}" > $FILE_PATH
echo "Written generated [${mac}] mac address."
else
echo "Config directory is not writable"
Expand Down
1 change: 1 addition & 0 deletions doc/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Older build might be dropped in order to save space on docker-hub and incur in l

Date|Type|Description
:---|:---|:---
2023-12-18|Improvement|Support for a config file prefix (see [#249](https://github.com/GioF71/squeezelite-docker/issues/249))
2023-12-18|Improvement|Autogen mac address (see [#247](https://github.com/GioF71/squeezelite-docker/issues/247))
2023-12-18|Improvement|Arguments in quotes (see [#245](https://github.com/GioF71/squeezelite-docker/issues/245))
2023-12-17|Improvement|Support output device `-o` also with PulseAudio (see [#243](https://github.com/GioF71/squeezelite-docker/issues/243))
Expand Down

0 comments on commit f8663c4

Please sign in to comment.