Merge pull request #3 from ksurl/fgenv

This commit is contained in:
Adam 2023-07-26 16:01:43 +01:00 committed by GitHub
commit 0a1b2a8279
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 6 deletions

View File

@ -22,6 +22,8 @@ param_container_name: "{{ project_name }}"
param_usage_include_env: true
param_env_vars:
- { env_var: "FG_LOG_LEVEL", env_value: "info", desc: "Set the FlexGet logging level." }
- { env_var: "FG_LOG_FILE", env_value: "/config/flexget.log", desc: "Set the FlexGet log file location." }
- { env_var: "FG_CONFIG_FILE", env_value: "/config/.flexget/config.yml", desc: "Set the FlexGet config file location." }
param_usage_include_vols: true
param_volumes:
- { vol_path: "/config", vol_host_path: "/path/to/data", desc: "Local path for FlexGet config files." }

View File

@ -5,17 +5,30 @@ mkdir -p \
/config/.flexget \
/data
FG_CONFIG_FILE="${FG_CONFIG_FILE:-/config/.flexget/config.yml}"
case "${FG_CONFIG_FILE}" in
*yml)
FG_LOCK_FILE="${FG_CONFIG_FILE/config.yml/.config-lock}"
;;
*yaml)
FG_LOCK_FILE="${FG_CONFIG_FILE/config.yaml/.config-lock}"
;;
default)
echo "invalid config file extension"
exit 1
;;
esac
# clean up config-lock from unclean shutdown
if [[ -f "/config/.flexget/.config-lock" ]]; then
rm -rf "/config/.flexget/.config-lock"
if [[ -f "${FG_LOCK_FILE}" ]]; then
rm -rf "${FG_LOCK_FILE}"
fi
if [[ ! -f "/config/.flexget/config.yml" ]]; then
cp /default/config.yml /config/.flexget/config.yml
if [[ ! -f "{$FG_CONFIG_FILE}" ]]; then
cp /default/config.yml "${FG_CONFIG_FILE}"
fi
if [[ -n "${FG_WEBUI_PASSWORD}" ]]; then
if ! flexget --loglevel error web passwd "${FG_WEBUI_PASSWORD}" | tee /dev/stderr | grep -q 'Updated password'; then
if ! flexget -c "${FG_CONFIG_FILE}" --loglevel error web passwd "${FG_WEBUI_PASSWORD}" | tee /dev/stderr | grep -q 'Updated password'; then
echo "Halting init, please address the above issues and recreate the container"
sleep infinity
fi

View File

@ -4,4 +4,4 @@
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 5050" \
s6-setuidgid abc python3 /lsiopy/bin/flexget \
--loglevel "${FG_LOG_LEVEL:-info}" --logfile "/config/flexget.log" -c /config/.flexget/config.yml daemon start --autoreload-config
--loglevel "${FG_LOG_LEVEL:-info}" --logfile "${FG_LOG_FILE:-/config/.flexget/flexget.log}" -c "${FG_CONFIG_FILE:-/config/.flexget/config.yml}" daemon start --autoreload-config