Check if ldap setup succeeded
This commit is contained in:
parent
42384d1166
commit
f617a52ca3
11
start.sh
11
start.sh
|
@ -5,6 +5,8 @@ set -eu -o pipefail
|
||||||
readonly fqdn=$(hostname -f)
|
readonly fqdn=$(hostname -f)
|
||||||
|
|
||||||
setup_ldap_source() {
|
setup_ldap_source() {
|
||||||
|
set -eu
|
||||||
|
|
||||||
# Wait for gogs to finish db setup, before we insert ldap source in db
|
# Wait for gogs to finish db setup, before we insert ldap source in db
|
||||||
while ! curl --fail http://localhost:3000/healthcheck; do
|
while ! curl --fail http://localhost:3000/healthcheck; do
|
||||||
echo "Waiting for gogs to come up"
|
echo "Waiting for gogs to come up"
|
||||||
|
@ -12,8 +14,13 @@ setup_ldap_source() {
|
||||||
done
|
done
|
||||||
|
|
||||||
# id, type, name, is_actived, cfg, allow_auto_register, created, updated
|
# id, type, name, is_actived, cfg, allow_auto_register, created, updated
|
||||||
mysql -u"${MYSQL_USERNAME}" -p"${MYSQL_PASSWORD}" -h mysql --database="${MYSQL_DATABASE}" \
|
if mysql -u"${MYSQL_USERNAME}" -p"${MYSQL_PASSWORD}" -h mysql --database="${MYSQL_DATABASE}" \
|
||||||
-e "REPLACE INTO login_source VALUES (1,2,'cloudron',1,'{\"Name\":\"cloudron\",\"Host\":\"${LDAP_SERVER}\",\"Port\":${LDAP_PORT},\"UseSSL\":false,\"UserBase\":\"${LDAP_USERS_BASE_DN}\",\"AttributeUsername\":\"uid\",\"AttributeName\":\"\",\"AttributeSurname\":\"\",\"AttributeMail\":\"mail\",\"Filter\":\"(\\\\u0026(objectClass=user)(uid=%s))\",\"AdminFilter\":\"(memberof=cn=admins,${LDAP_GROUPS_BASE_DN})\",\"Enabled\":true}','2015-06-24 17:14:12','2015-06-24 17:25:03');"
|
-e "REPLACE INTO login_source VALUES (1,2,'cloudron',1,'{\"Name\":\"cloudron\",\"Host\":\"${LDAP_SERVER}\",\"Port\":${LDAP_PORT},\"UseSSL\":false,\"UserBase\":\"${LDAP_USERS_BASE_DN}\",\"AttributeUsername\":\"uid\",\"AttributeName\":\"\",\"AttributeSurname\":\"\",\"AttributeMail\":\"mail\",\"Filter\":\"(\\\\u0026(objectClass=user)(uid=%s))\",\"AdminFilter\":\"(memberof=cn=admins,${LDAP_GROUPS_BASE_DN})\",\"Enabled\":true}','2015-06-24 17:14:12','2015-06-24 17:25:03');"; then
|
||||||
|
echo "LDAP Authentication Setup"
|
||||||
|
else
|
||||||
|
echo "Failed to setup LDAP authentication"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
sed -e "s/^Port .*/Port ${SSH_PORT}/" \
|
sed -e "s/^Port .*/Port ${SSH_PORT}/" \
|
||||||
|
|
Loading…
Reference in New Issue