Use CONFIG_LOCATION only for migration

This commit is contained in:
Alexandre
2026-01-09 10:11:18 +01:00
parent 2dd05df4c9
commit 6bbb3de5fe
32 changed files with 227 additions and 81 deletions

View File

@@ -1,4 +1,7 @@
## 6.4.15-1 (09-01-2026)
- ⚠ MAJOR CHANGE : switch to the new config logic from homeassistant. Your configuration files will have migrated from /config/addons_config/fireflyiii to a folder only accessible from my Filebrowser addon called /addon_configs/xxx-fireflyiii. Please make a backup before updating.
## 6.4.15 (08-01-2026)
- Update to latest version from firefly-iii/firefly-iii (changelog : https://github.com/firefly-iii/firefly-iii/releases)

View File

@@ -47,7 +47,7 @@ Configurations can be done through the app webUI, except for the following optio
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `APP_KEY` | str | `CHANGEME_32_CHARS_EuC5dfn3LAPzeO` | **CRITICAL**: 32-character encryption key - change before first run! |
| `CONFIG_LOCATION` | str | `/config/addons_config/fireflyiii/config.yaml` | Location of additional config file |
| `CONFIG_LOCATION` | str | `/addon_configs/xxx-fireflyiii/config.yaml` | Location of additional config file |
| `DB_CONNECTION` | list | `sqlite_internal` | Database type (sqlite_internal/mariadb_addon/mysql/pgsql) |
| `DB_HOST` | str | | Database host (for external databases) |
| `DB_PORT` | str | | Database port (for external databases) |
@@ -61,7 +61,7 @@ Configurations can be done through the app webUI, except for the following optio
```yaml
APP_KEY: "SomeRandomStringOf32CharsExactly"
CONFIG_LOCATION: "/config/addons_config/fireflyiii/config.yaml"
CONFIG_LOCATION: "/addon_configs/xxx-fireflyiii/config.yaml"
DB_CONNECTION: "mariadb_addon"
DB_HOST: "core-mariadb"
DB_PORT: "3306"
@@ -101,4 +101,3 @@ Create an issue on github
[repository]: https://github.com/alexbelgium/hassio-addons

View File

@@ -69,13 +69,14 @@ environment:
image: ghcr.io/alexbelgium/fireflyiii-{arch}
init: false
map:
- config:rw
- addon_config:rw
- homeassistant_config:rw
- share:rw
name: Firefly iii
options:
env_vars: []
APP_KEY: CHANGEME_32_CHARS_EuC5dfn3LAPzeO
CONFIG_LOCATION: /config/addons_config/fireflyiii/config.yaml
CONFIG_LOCATION: /config/config.yaml
DB_CONNECTION: sqlite_internal
silent: "true"
ports:
@@ -104,5 +105,5 @@ slug: fireflyiii
startup: services
udev: true
url: https://github.com/alexbelgium/hassio-addons
version: "6.4.15"
version: "6.4.15-1"
webui: "[PROTO:ssl]://[HOST]:[PORT:8080]"

View File

@@ -3,6 +3,24 @@
set -e
# hadolint ignore=SC2155
slug=fireflyiii
legacy_path="/homeassistant/addons_config/$slug"
target_path="/config"
mkdir -p "$target_path"
if bashio::config.has_value 'CONFIG_LOCATION' && [ "$(bashio::config 'CONFIG_LOCATION')" != "/config" ]; then
legacy_path="$(bashio::config 'CONFIG_LOCATION')"
fi
if [ -d "$legacy_path" ]; then
if [ ! -f "$legacy_path/.migrated" ] || [ -z "$(ls -A "$target_path" 2>/dev/null)" ]; then
echo "Migrating $legacy_path to $target_path"
cp -rnf "$legacy_path"/. "$target_path"/ || true
touch "$legacy_path/.migrated"
fi
fi
########
# Init #
########
@@ -17,24 +35,24 @@ if [[ ! "$APP_KEY" == *"base64"* ]]; then
fi
# Backup APP_KEY file
bashio::log.info "Backuping APP_KEY to /config/addons_config/fireflyiii/APP_KEY_BACKUP.txt"
bashio::log.info "Backuping APP_KEY to /config/APP_KEY_BACKUP.txt"
bashio::log.warning "Changing this value will require to reset your database"
# Get current app_key
mkdir -p /config/addons_config/fireflyiii
touch /config/addons_config/fireflyiii/APP_KEY_BACKUP.txt
CURRENT=$(sed -e '/^[<blank><tab>]*$/d' /config/addons_config/fireflyiii/APP_KEY_BACKUP.txt | sed -n -e '$p')
mkdir -p /config
touch /config/APP_KEY_BACKUP.txt
CURRENT=$(sed -e '/^[<blank><tab>]*$/d' /config/APP_KEY_BACKUP.txt | sed -n -e '$p')
# Save if new
if [ "$CURRENT" != "$APP_KEY" ]; then
echo "$APP_KEY" >> /config/addons_config/fireflyiii/APP_KEY_BACKUP.txt
echo "$APP_KEY" >> /config/APP_KEY_BACKUP.txt
fi
# Update permissions
mkdir -p /config/addons_config/fireflyiii
chown -R www-data:www-data /config/addons_config/fireflyiii
mkdir -p /config
chown -R www-data:www-data /config
chown -R www-data:www-data /var/www/html/storage
chmod -R 775 /config/addons_config/fireflyiii
chmod -R 775 /config
###################
# Define database #
@@ -49,16 +67,16 @@ case $(bashio::config 'DB_CONNECTION') in
# Set variable
export DB_CONNECTION=sqlite
export DB_DATABASE=/config/addons_config/fireflyiii/database/database.sqlite
export DB_DATABASE=/config/database/database.sqlite
# Creating folders
mkdir -p /config/addons_config/fireflyiii/database
chown -R www-data:www-data /config/addons_config/fireflyiii/database
mkdir -p /config/database
chown -R www-data:www-data /config/database
# Creating database
if [ ! -f /config/addons_config/fireflyiii/database/database.sqlite ]; then
if [ ! -f /config/database/database.sqlite ]; then
# Create database
touch /config/addons_config/fireflyiii/database/database.sqlite
touch /config/database/database.sqlite
# Install database
echo "updating database"
php artisan migrate:refresh --seed --quiet
@@ -68,11 +86,11 @@ case $(bashio::config 'DB_CONNECTION') in
# Creating symlink
rm -r /var/www/html/storage/database
ln -s /config/addons_config/fireflyiii/database /var/www/html/storage
ln -s /config/database /var/www/html/storage
# Updating permissions
chmod 775 /config/addons_config/fireflyiii/database/database.sqlite
chown -R www-data:www-data /config/addons_config/fireflyiii
chmod 775 /config/database/database.sqlite
chown -R www-data:www-data /config
chown -R www-data:www-data /var/www/html/storage
;;
@@ -132,24 +150,24 @@ esac
bashio::log.info "Defining upload folder"
# Creating folder
if [ ! -d /config/addons_config/fireflyiii/upload ]; then
mkdir -p /config/addons_config/fireflyiii/upload
chown -R www-data:www-data /config/addons_config/fireflyiii/upload
if [ ! -d /config/upload ]; then
mkdir -p /config/upload
chown -R www-data:www-data /config/upload
fi
# Creating symlink
if [ -d /var/www/html/storage/ha_upload ]; then
rm -r /var/www/html/storage/ha_upload
fi
ln -s /config/addons_config/fireflyiii/upload /var/www/html/storage/ha_upload
ln -s /config/upload /var/www/html/storage/ha_upload
# Updating permissions
chown -R www-data:www-data /config/addons_config/fireflyiii
chown -R www-data:www-data /config
chown -R www-data:www-data /var/www/html/storage
chmod -R 775 /config/addons_config/fireflyiii
chmod -R 775 /config
# Test
f=/config/addons_config/fireflyiii
f=/config
while [[ $f != / ]]; do
chmod 755 "$f"
f=$(dirname "$f")