1
0
mirror of https://git.cloudron.io/cloudron/freshrss-app synced 2025-09-04 14:25:37 +00:00

OIDC auth implemented, tests amended

This commit is contained in:
Vladimir D
2023-10-27 12:36:22 +04:00
parent 8b6fbb5aab
commit f8e08f1c51
6 changed files with 132 additions and 22 deletions

View File

@@ -13,11 +13,21 @@ if ! [ -f /app/data/.installed ]; then
--db-user "${CLOUDRON_MYSQL_USERNAME}" --db-password "${CLOUDRON_MYSQL_PASSWORD}" \
--db-base "${CLOUDRON_MYSQL_DATABASE}" --db-prefix "" \
--disable_update
php cli/create-user.php --user admin --password changeme --language en
if [ -z "${CLOUDRON_OIDC_ISSUER:-}" ]; then
php cli/create-user.php --user admin --password changeme --language en
fi
touch /app/data/.installed
echo "==> Done."
fi
echo "==> Get OAUTH Crypto Passphrase"
if [[ ! -f /app/data/.oauth_crypto_passphrase ]]; then
openssl rand -base64 42 > /app/data/.oauth_crypto_passphrase
fi
export OIDC_CRYPTO_PASSPHRASE=$(</app/data/.oauth_crypto_passphrase)
if [[ ! -f /app/data/php.ini ]]; then
echo -e "; Add custom PHP configuration in this file\n; Settings here are merged with the package's built-in php.ini\n\n" > /app/data/php.ini
fi
@@ -41,10 +51,16 @@ php cli/reconfigure.php --default_user admin --base_url "https://${CLOUDRON_APP_
--db-base "${CLOUDRON_MYSQL_DATABASE}" --db-prefix "" \
--disable_update
if [[ -z "${CLOUDRON_OIDC_ISSUER:-}" ]]; then
php cli/reconfigure.php --default_user admin
else
php cli/reconfigure.php --auth_type "http_auth"
fi
echo "==> Setting permissions"
chown -R www-data.www-data /run/php /app/data /tmp/log_api.txt
echo "==> Starting apache"
APACHE_CONFDIR="" source /etc/apache2/envvars
rm -f "${APACHE_PID_FILE}"
exec /usr/sbin/apache2 -DFOREGROUND
exec /usr/sbin/apache2 -D FOREGROUND $([ -n "$CLOUDRON_OIDC_ISSUER" ] && echo '-D OIDC_ENABLED')