mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-04-07 22:47:02 +02:00
- Add Accounts list schema to config.yaml for multi-account support - Make ApiKey and ImmichServerUrl optional when using Accounts list - Generate Settings.yaml from addon options in 99-run.sh - Fix /app/Config symlink direction for proper config persistence - Set IMMICHFRAME_CONFIG_PATH for reliable config discovery - Update README with multi-account documentation and examples - Bump version to 1.0.32.0-2 Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com>
48 lines
1.8 KiB
Bash
Executable File
48 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bashio
|
|
|
|
bashio::log.info "Starting Immich Frame"
|
|
|
|
mkdir -p /config/Config
|
|
if [ -d /app/Config ] && [ ! -L /app/Config ]; then
|
|
cp -n /app/Config/* /config/Config/ 2>/dev/null || true
|
|
rm -rf /app/Config
|
|
fi
|
|
if [ ! -e /app/Config ]; then
|
|
ln -sf /config/Config /app/Config
|
|
fi
|
|
|
|
# Generate Settings.yaml from addon options for multi-account support
|
|
SETTINGS_FILE="/config/Config/Settings.yaml"
|
|
ACCOUNT_COUNT=$(jq '.Accounts | length' /data/options.json 2>/dev/null || echo 0)
|
|
|
|
if [ "$ACCOUNT_COUNT" -gt 0 ]; then
|
|
bashio::log.info "Configuring ${ACCOUNT_COUNT} account(s) from Accounts list"
|
|
{
|
|
echo "Accounts:"
|
|
for i in $(seq 0 $((ACCOUNT_COUNT - 1))); do
|
|
SERVER_URL=$(jq -r ".Accounts[${i}].ImmichServerUrl" /data/options.json)
|
|
API_KEY=$(jq -r ".Accounts[${i}].ApiKey" /data/options.json)
|
|
echo " - ImmichServerUrl: '${SERVER_URL}'"
|
|
echo " ApiKey: '${API_KEY}'"
|
|
bashio::log.info " Account $((i + 1)): ${SERVER_URL}"
|
|
done
|
|
} > "${SETTINGS_FILE}"
|
|
bashio::log.info "Settings.yaml generated at ${SETTINGS_FILE}"
|
|
elif bashio::config.has_value 'ApiKey' && bashio::config.has_value 'ImmichServerUrl'; then
|
|
bashio::log.info "Using single account configuration"
|
|
SERVER_URL=$(bashio::config 'ImmichServerUrl')
|
|
API_KEY=$(bashio::config 'ApiKey')
|
|
{
|
|
echo "Accounts:"
|
|
echo " - ImmichServerUrl: '${SERVER_URL}'"
|
|
echo " ApiKey: '${API_KEY}'"
|
|
} > "${SETTINGS_FILE}"
|
|
bashio::log.info "Settings.yaml generated at ${SETTINGS_FILE}"
|
|
else
|
|
bashio::log.fatal "No accounts configured! Set either 'Accounts' list or both 'ApiKey' and 'ImmichServerUrl'"
|
|
exit 1
|
|
fi
|
|
|
|
export IMMICHFRAME_CONFIG_PATH=/config/Config
|
|
exec dotnet ImmichFrame.WebApi.dll
|