mirror of
https://git.cloudron.io/cloudron/peertube-app.git
synced 2024-11-22 01:21:10 +00:00
always install oidc plugin
This commit is contained in:
parent
4fcf9b1684
commit
3c7afbe0ca
1 changed files with 17 additions and 22 deletions
39
start.sh
39
start.sh
|
@ -8,27 +8,20 @@ mkdir -p /app/data/storage /run/peertube/cache /run/peertube/npm /tmp/peertube
|
||||||
cd /app/code/server
|
cd /app/code/server
|
||||||
|
|
||||||
migrate_ldap_to_oidc() {
|
migrate_ldap_to_oidc() {
|
||||||
if [[ -n "${CLOUDRON_OIDC_ISSUER:-}" ]]; then
|
USERS_TO_MIGRATE=$(PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -AXqtc "SELECT count(*) FROM \"user\" u WHERE \"pluginAuth\"='peertube-plugin-auth-ldap'")
|
||||||
OIDC_PLUIGIN_INSTALLED=$(PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -AXqtc "SELECT count(*) FROM \"plugin\" WHERE name='auth-openid-connect'")
|
echo "==> Migrating users to OIDC";
|
||||||
if [ ${OIDC_PLUIGIN_INSTALLED} -eq 0 ]; then
|
echo " Users to migrate: ${USERS_TO_MIGRATE}"
|
||||||
install_oidc
|
if [ ${USERS_TO_MIGRATE} -gt 0 ]; then
|
||||||
fi
|
PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -c "UPDATE \"user\" SET \"pluginAuth\"='peertube-plugin-auth-openid-connect' WHERE \"pluginAuth\"='peertube-plugin-auth-ldap'"
|
||||||
|
fi
|
||||||
|
|
||||||
USERS_TO_MIGRATE=$(PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -AXqtc "SELECT count(*) FROM \"user\" u WHERE \"pluginAuth\"='peertube-plugin-auth-ldap'")
|
LDAP_PLUGIN_INSTALLED=$(PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -AXqtc "SELECT count(*) FROM \"plugin\" WHERE name='auth-ldap'")
|
||||||
echo "==> Migrating users to OIDC";
|
if [ ${LDAP_PLUGIN_INSTALLED} -gt 0 ]; then
|
||||||
echo " Users to migrate: ${USERS_TO_MIGRATE}"
|
echo "==> Uninstalling LDAP plugin"
|
||||||
if [ ${USERS_TO_MIGRATE} -gt 0 ]; then
|
gosu cloudron:cloudron npm run plugin:uninstall -- -n peertube-plugin-auth-ldap
|
||||||
PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -c "UPDATE \"user\" SET \"pluginAuth\"='peertube-plugin-auth-openid-connect' WHERE \"pluginAuth\"='peertube-plugin-auth-ldap'"
|
|
||||||
fi
|
|
||||||
|
|
||||||
LDAP_PLUGIN_INSTALLED=$(PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -AXqtc "SELECT count(*) FROM \"plugin\" WHERE name='auth-ldap'")
|
echo "==> Deleting LDAP settings"
|
||||||
if [ ${LDAP_PLUGIN_INSTALLED} -gt 0 ]; then
|
PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -c "DELETE FROM \"plugin\" WHERE name='auth-ldap'"
|
||||||
echo "==> Uninstalling LDAP plugin"
|
|
||||||
gosu cloudron:cloudron npm run plugin:uninstall -- -n peertube-plugin-auth-ldap
|
|
||||||
|
|
||||||
echo "==> Deleting LDAP settings"
|
|
||||||
PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -c "DELETE FROM \"plugin\" WHERE name='auth-ldap'"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,9 +131,11 @@ if [[ ! -f "/app/data/production.yaml" ]]; then
|
||||||
first_time_setup
|
first_time_setup
|
||||||
else
|
else
|
||||||
update_config
|
update_config
|
||||||
migrate_ldap_to_oidc
|
if [[ -n "${CLOUDRON_OIDC_ISSUER:-}" ]]; then
|
||||||
|
install_oidc
|
||||||
[[ -n "${CLOUDRON_OIDC_ISSUER:-}" ]] && update_oidc
|
migrate_ldap_to_oidc
|
||||||
|
update_oidc
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "==> Configuring nginx"
|
echo "==> Configuring nginx"
|
||||||
|
|
Loading…
Reference in a new issue