mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
* chore(docker): ship awslocal wrapper in the -compat image bin/awslocal was added to the repo in #638 but is not COPYed into any of the published Docker images. That makes existing LocalStack init scripts mounted at /etc/localstack/init/ready.d/ — which overwhelmingly use `awslocal kinesis …` rather than `aws --endpoint-url=… kinesis …` — fail with "command not found" on the supposedly drop-in -compat image. The script also needed an entry in .dockerignore: the file is allow-list style ("*" + "!path") and bin/awslocal was not in the allow list, so it never reached the build context. Without that line the COPY fails with "file not found in build context". Closes #744. The orthogonal SQS endpoint-resolver issue tracked in #745 is unaffected by this change — awslocal as written only exports AWS_ENDPOINT_URL, which the bundled botocore silently ignores for SQS. * fix(awslocal): pass --endpoint-url explicitly to honor hard-pin contract LocalStack's awslocal idiom is "hard-pin the endpoint" — that's the whole point of the wrapper. Setting AWS_ENDPOINT_URL alone is not sufficient: the bundled aws-cli/1.44.87 + botocore/1.42.97 silently bypasses the env var for SQS via service-specific endpoint resolvers, sending requests to public AWS. With real credentials in CI/dev, that would silently provision real SQS queues — surfacing as the InvalidClientTokenId error documented in #745. Inject --endpoint-url before "$@" so the user's own --endpoint-url (if any) still wins via last-flag-wins. Verified: awslocal sqs create-queue and list-queues now route to Floci; kinesis/s3 still work; awslocal env subcommand unaffected; user override behaves correctly. Addresses Copilot's review feedback on #746 and the awslocal arm of #745.
33 lines
1.3 KiB
Bash
Executable File
33 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
_ENDPOINT="${FLOCI_ENDPOINT:-http://localhost:4566}"
|
|
_REGION="${AWS_DEFAULT_REGION:-us-east-1}"
|
|
|
|
if [[ "${1:-}" == "env" ]]; then
|
|
if [[ "${2:-}" == "--unset" ]]; then
|
|
echo 'unset AWS_ENDPOINT_URL'
|
|
echo 'unset AWS_ACCESS_KEY_ID'
|
|
echo 'unset AWS_SECRET_ACCESS_KEY'
|
|
echo 'unset AWS_DEFAULT_REGION'
|
|
echo '# Run this command to unset floci env vars:'
|
|
echo '# eval $(awslocal env --unset)'
|
|
else
|
|
echo "export AWS_ENDPOINT_URL=\"${_ENDPOINT}\""
|
|
echo "export AWS_ACCESS_KEY_ID=\"${AWS_ACCESS_KEY_ID:-test}\""
|
|
echo "export AWS_SECRET_ACCESS_KEY=\"${AWS_SECRET_ACCESS_KEY:-test}\""
|
|
echo "export AWS_DEFAULT_REGION=\"${_REGION}\""
|
|
echo '# Run this command to configure your shell:'
|
|
echo '# eval $(awslocal env)'
|
|
fi
|
|
exit 0
|
|
fi
|
|
|
|
export AWS_ENDPOINT_URL="${_ENDPOINT}"
|
|
export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:-test}"
|
|
export AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:-test}"
|
|
export AWS_DEFAULT_REGION="${_REGION}"
|
|
|
|
# Pass --endpoint-url explicitly: a few SDKs/services (notably SQS in older
|
|
# botocore) silently bypass AWS_ENDPOINT_URL via service-specific endpoint
|
|
# resolvers, sending the call to public AWS instead of Floci.
|
|
exec aws --endpoint-url "${_ENDPOINT}" "$@" |