forked from ome/omero-server-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge master -Dorg -Snone: PR 2 (Enable public user)
- Loading branch information
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
# Configure web public user if enabled | ||
# Waits for OMERO to start before creating necessary accounts so there is a very | ||
# brief window on first startup when OMERO.server and OMERO.web may be available | ||
# but the public user is not yet created | ||
|
||
set -eu | ||
|
||
omero=/opt/omero/server/OMERO.server/bin/omero | ||
CONFIG_omero_web_public_enabled=${CONFIG_omero_web_public_enabled:-false} | ||
|
||
function createPublicUser { | ||
PUBLIC_GROUP=${PUBLIC_GROUP:-public-group} | ||
CONFIG_omero_web_public_user=${CONFIG_omero_web_public_user:-public-user} | ||
CONFIG_omero_web_public_password=${CONFIG_omero_web_public_password:-omero} | ||
|
||
$omero -s localhost -p 4064 -u root -w $ROOTPASS group info $PUBLIC_GROUP \ | ||
&& echo "Skipping existing public group ($PUBLIC_GROUP) creation" \ | ||
|| $omero -s localhost -p 4064 -u root -w $ROOTPASS group add --type read-only $PUBLIC_GROUP | ||
$omero -s localhost -p 4064 -u root -w $ROOTPASS user info $CONFIG_omero_web_public_user \ | ||
&& echo "Skipping existing public user ($CONFIG_omero_web_public_user) creation" \ | ||
|| $omero -s localhost -p 4064 -u root -w $ROOTPASS user add --group-name $PUBLIC_GROUP -P $CONFIG_omero_web_public_password $CONFIG_omero_web_public_user Public User | ||
} | ||
|
||
# Never time out as there could be steps of unknown duration between this and | ||
# OMERO server successfully starting. | ||
function waitForOmero { | ||
while ! $omero -s localhost -p 4064 -u root -w $ROOTPASS login >/dev/null 2>&1; do | ||
echo "$(date) - waiting for OMERO server..." | ||
sleep 5 | ||
done | ||
echo "OMERO server connection established" | ||
createPublicUser | ||
} | ||
|
||
if [ "$CONFIG_omero_web_public_enabled" = true ]; then | ||
waitForOmero & | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters