#!/usr/bin/env bash

# demo-rais-entry.sh is the RAIS entrypoint script, which sets up the
# configuration and runs the rais server

# Copy the config and edit it in-place; this allows customizing most pieces of
# configuration for demoing
url=${URL:-}
if [[ $url == "" ]]; then
  echo "No URL provided; defaulting to 'http://localhost'"
  echo "If you can't see images, try an explicitly-set URL, e.g.:"
  echo
  echo "    URL="http://192.168.0.5" docker-compose up"
  url="http://localhost"
fi

cp /etc/rais-template.toml /tmp/rais.toml
sed 's|^\s*IIIFURL.*$|IIIFURL = "'$url'/images/iiif"|' /tmp/rais.toml > /etc/rais.toml
exec /opt/rais/rais-server

#!/usr/bin/env sh

# demo-rais-entry.sh is the RAIS entrypoint script, which sets up the
# configuration and runs the rais server

# Copy the config and edit it in-place; this allows customizing most pieces of
# configuration for demoing
url=${URL:-}
if test "$url" == ""; then
  echo "No URL provided; defaulting to 'http://localhost'"
  echo "If you can't see images, try an explicitly-set URL, e.g.:"
  echo
  echo "    URL="http://192.168.0.5" docker-compose up"
  url="http://localhost"
fi

cp /etc/rais-template.toml /tmp/rais.toml
sed 's|^\s*IIIFURL.*$|IIIFURL = "'$url'/images/iiif"|' /tmp/rais.toml > /etc/rais.toml
exec /opt/rais/rais-server

Make demo work with alpine
Make demo work with alpine

If you specify (in the docker-compose.override.yml) that you want to use
the alpine image for the demo, the entrypoint has to work with sh, not
use bash-specific testing.  This makes that possible.
