2021-09-05 06:10:54 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2022-12-10 23:25:25 +03:00
|
|
|
# - Find custom files (bridges, formats, whitelist, config.ini) in the /config folder
|
2021-09-05 06:10:54 +03:00
|
|
|
# - Copy them to the respective folders in /app
|
2022-12-10 23:25:25 +03:00
|
|
|
# This will overwrite previous configs, bridges and formats of same name
|
2021-09-05 06:10:54 +03:00
|
|
|
# If there are no matching files, rss-bridge works like default.
|
|
|
|
|
2022-05-14 14:18:58 +03:00
|
|
|
find /config/ -type f -name '*' -print0 2> /dev/null |
|
2021-09-05 06:10:54 +03:00
|
|
|
while IFS= read -r -d '' file; do
|
|
|
|
file_name="$(basename "$file")" # Strip leading path
|
|
|
|
if [[ $file_name = *" "* ]]; then
|
2022-12-10 23:25:25 +03:00
|
|
|
printf 'Custom file %s has a space in the name and will be skipped.\n' "$file_name"
|
2021-09-05 06:10:54 +03:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
case "$file_name" in
|
|
|
|
*Bridge.php) yes | cp "$file" /app/bridges/ ;
|
|
|
|
chown www-data:www-data "/app/bridges/$file_name";
|
|
|
|
printf "Custom Bridge %s added.\n" $file_name;;
|
2022-12-10 23:25:25 +03:00
|
|
|
*Format.php) yes | cp "$file" /app/formats/ ;
|
|
|
|
chown www-data:www-data "/app/formats/$file_name";
|
|
|
|
printf "Custom Format %s added.\n" $file_name;;
|
2021-09-05 06:10:54 +03:00
|
|
|
config.ini.php) yes | cp "$file" /app/ ;
|
|
|
|
chown www-data:www-data "/app/$file_name";
|
|
|
|
printf "Custom config.ini.php added.\n";;
|
|
|
|
whitelist.txt) yes | cp "$file" /app/ ;
|
|
|
|
chown www-data:www-data "/app/$file_name";
|
|
|
|
printf "Custom whitelist.txt added.\n";;
|
2022-03-22 22:47:40 +03:00
|
|
|
DEBUG) yes | cp "$file" /app/ ;
|
|
|
|
chown www-data:www-data "/app/$file_name";
|
|
|
|
printf "DEBUG file added.\n";;
|
2021-09-05 06:10:54 +03:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2021-10-09 20:02:38 +03:00
|
|
|
# This feature can set the internal port that apache uses to something else.
|
|
|
|
# If docker is run on network:service mode, no two containers can use port 80
|
|
|
|
# To use this, start the container with the additional environment variable "HTTP_PORT"
|
|
|
|
if [ ! -z ${HTTP_PORT} ]; then
|
2022-05-12 03:19:25 +03:00
|
|
|
sed -i "s/80/$HTTP_PORT/g" /etc/nginx/sites-enabled/default
|
2021-10-09 20:02:38 +03:00
|
|
|
fi
|
|
|
|
|
2022-05-12 03:19:25 +03:00
|
|
|
# nginx will daemonize
|
|
|
|
nginx
|
2021-10-09 20:02:38 +03:00
|
|
|
|
2022-05-12 03:19:25 +03:00
|
|
|
# php-fpm will not
|
|
|
|
php-fpm
|