#!/bin/sh set -eu secret() { tr -d '\r\n' < "/run/secrets/$1"; } endpoint="${S3_ENDPOINT:-http://s3:9000}" RC_HOST_root="${endpoint%%://*}://$(secret s3_root_user):$(secret s3_root_password)@${endpoint#*://}" RC_HOST_api="${endpoint%%://*}://$(secret s3_access_key_id):$(secret s3_secret_access_key)@${endpoint#*://}" export RC_HOST_root RC_HOST_api rc alias set anon "$endpoint" --anonymous >/dev/null case "${1:-}" in sh|wget) exec "$@" ;; esac exec rc "$@"