Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Add config file prefix variable #249 #251

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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