From d31244bdd66e81732daec04b7e4073d76db01532 Mon Sep 17 00:00:00 2001 From: many Date: Wed, 4 Jun 2025 19:15:05 -0400 Subject: [PATCH] Fix regression where not using OpenID would cause the recipe to fail to deploy --- README.md | 3 +++ entrypoint.sh | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d06fb42..132183f 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,9 @@ * `abra app new civicrm-wordpress` * `abra app config ` +SMTP: +* Make sure to configure Traefik to support SMTP + Authentik integration: * When configuring, uncomment `COMPOSE_FILE`, `OPEN_ID_CLIENT_ID`, `SECRET_OPEN_ID_CLIENT_SECRET_VERSION`, and `AUTHENTIK_DOMAIN` * To configure your Authentik deployment, follow the guide at [`docs.goauthentik.io/integrations/services/wordpress`](https://docs.goauthentik.io/integrations/services/wordpress/). diff --git a/entrypoint.sh b/entrypoint.sh index 78b88cc..43631ad 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -89,33 +89,44 @@ pushd /var/www/html/wp-content/uploads/civicrm/ fi popd -if [[ -n "${OPEN_ID_CLIENT_ID}" ]]; then +OPEN_ID_CLIENT_ID="${OPEN_ID_CLIENT_ID:-unused}" +if [ "$OPEN_ID_CLIENT_ID" != "unused" ]; then # install OpenID Connect Generic plugin if ! su civicrm -c "wp plugin is-installed daggerhart-openid-connect-generic"; then echo "============ Running OpenId Connect Install ============" su civicrm -c "wp plugin install daggerhart-openid-connect-generic --activate" + else + echo "OpenID Connect Generic Plugin already installed" fi # if openid connect hasn't been configured, insert default settings if ! su civicrm -c "wp option get openid_connect_generic_settings"; then + echo "Configuring OpenId Connect Plugin default settings" su civicrm -c "wp option add openid_connect_generic_settings --format=json < /usr/local/etc/civicrm/openid_settings.json" + else + echo "OpenId Connect Plugin default settings already present" fi echo "============ Configuring OpenId Connect ============" su civicrm -c "wp option patch update openid_connect_generic_settings client_id $OPEN_ID_CLIENT_ID" su civicrm -c "wp option patch update openid_connect_generic_settings client_secret $OPEN_ID_CLIENT_SECRET" - if [[ -n "${AUTHENTIK_DOMAIN}" ]]; then + AUTHENTIK_DOMAIN="${AUTHENTIK_DOMAIN:-unused}" + if [ "$AUTHENTIK_DOMAIN" != "unused" ]; then + echo "============ Configuring Authentik ============" su civicrm -c "wp option patch update openid_connect_generic_settings endpoint_login https://$AUTHENTIK_DOMAIN/application/o/authorize/" su civicrm -c "wp option patch update openid_connect_generic_settings endpoint_userinfo https://$AUTHENTIK_DOMAIN/application/o/userinfo/" su civicrm -c "wp option patch update openid_connect_generic_settings endpoint_token https://$AUTHENTIK_DOMAIN/application/o/token/" su civicrm -c "wp option patch update openid_connect_generic_settings endpoint_end_session https://$AUTHENTIK_DOMAIN/application/o/wordpress/end-session/" else + echo "============ Configuring Generic OpenId Provider ============" su civicrm -c "wp option patch update openid_connect_generic_settings endpoint_login $OPEN_ID_PROVIDER_LOGIN_URL" su civicrm -c "wp option patch update openid_connect_generic_settings endpoint_userinfo $OPEN_ID_USERINFO_URL" su civicrm -c "wp option patch update openid_connect_generic_settings endpoint_token $OPEN_ID_TOKEN_ENDPOINT_URL" su civicrm -c "wp option patch update openid_connect_generic_settings endpoint_end_session $OPEN_ID_END_SESSION_URL" fi +else + echo "not using OpenIdConnect" fi echo "============ Setting up cron ============"