Allow base64 key

https://github.com/alexbelgium/hassio-addons/issues/217
This commit is contained in:
Alexandre
2022-02-16 20:16:45 +01:00
committed by GitHub
parent bc2e12d54e
commit ded2984454

View File

@@ -8,9 +8,11 @@
# APP_KEY
APP_KEY="$(bashio::config 'APP_KEY')"
# Check APP_KEY format
APP_KEY_COUNT=${APP_KEY#*base64:}
if [ ! ${#APP_KEY_COUNT} = 32 ]; then bashio::exit.nok "Your APP_KEY has ${#APP_KEY_COUNT} instead of 32 characters"; fi
# If not base64
if [[ ! "$APP_KEY" == *"base64"* ]]; then
# Check APP_KEY format
if [ ! ${#APP_KEY} = 32 ]; then bashio::exit.nok "Your APP_KEY has ${#APP_KEY} instead of 32 characters"; fi
fi
# Backup APP_KEY file
bashio::log.info "Backuping APP_KEY to /config/addons_config/fireflyiii/APP_KEY_BACKUP.txt"