storj/cmd/satellite/entrypoint
Jess G e725535873
cmd/satellite: add gc to entrypoint (#3842)
Change-Id: I49816628bc4301006e4a54b5582b3d759806b5e7
2020-04-02 08:39:13 -07:00

45 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
set -euo pipefail
SETUP_PARAMS=""
if [[ -n "${API_KEY:-}" ]]; then
export STORJ_POINTER_DB_AUTH_API_KEY="${API_KEY}"
export STORJ_AUDIT_API_KEY="${API_KEY}"
export STORJ_POINTER_DB_AUTH_API_KEY="${API_KEY}"
export STORJ_REPAIRER_API_KEY="${API_KEY}"
fi
if [[ -n "${STORJ_DATABASE:-}" ]]; then
export STORJ_POINTER_DB_DATABASE_URL="${STORJ_DATABASE}"
fi
if [[ -n "${IDENTITY_ADDR:-}" ]]; then
export STORJ_SERVER_ADDRESS="${IDENTITY_ADDR}"
fi
if [[ ! -f "${CONF_PATH}/config.yaml" ]]; then
./satellite setup $SETUP_PARAMS
fi
RUN_PARAMS="${RUN_PARAMS:-} --config-dir ${CONF_PATH}"
if [ "${SATELLITE_MIGRATE:-}" = "true" ]; then
exec ./satellite run migration $RUN_PARAMS "$@"
fi
if [ "${SATELLITE_API:-}" = "true" ]; then
exec ./satellite run api $RUN_PARAMS "$@"
fi
if [ "${SATELLITE_REPAIR:-}" = "true" ]; then
exec ./satellite run repair $RUN_PARAMS "$@"
fi
if [ "${SATELLITE_GC:-}" = "true" ]; then
exec ./satellite run garbage-collection $RUN_PARAMS "$@"
fi
exec ./satellite run $RUN_PARAMS "$@"