Enforce environment variable configuration for Docker entrypoint
CI / Go Tests (push) Successful in 12s
CI / Build (push) Successful in 11s
Format / gofmt (push) Successful in 6s
Release Artifacts / Validate release tag (push) Successful in 2s
Release Artifacts / Build and release executables (push) Successful in 16s
Release Artifacts / Build and release Docker image (push) Successful in 26s
CI / Go Tests (push) Successful in 12s
CI / Build (push) Successful in 11s
Format / gofmt (push) Successful in 6s
Release Artifacts / Validate release tag (push) Successful in 2s
Release Artifacts / Build and release executables (push) Successful in 16s
Release Artifacts / Build and release Docker image (push) Successful in 26s
- Updated `docker-entrypoint.sh` to disallow custom command-line arguments, requiring configuration through `SCRATCHBOX_*` environment variables. - Modified `README.md` to clarify that custom container commands are not supported and to reflect the new entrypoint behavior. - Enhanced `main_test.go` to validate failure when required environment variables are not set. - Added a function in `server.go` to print startup environment variables, ensuring visibility of configuration during server initialization.
This commit is contained in:
@@ -13,12 +13,10 @@ export SCRATCHBOX_SERVER_LISTEN_ADDR
|
||||
SCRATCHBOX_SERVER_ACCESS_LOG_FILE_PATH=
|
||||
export SCRATCHBOX_SERVER_ACCESS_LOG_FILE_PATH
|
||||
|
||||
# Default to running the server from SCRATCHBOX_* env vars.
|
||||
if [ "$#" -eq 0 ]; then
|
||||
set -- server --env
|
||||
elif [ "${1#-}" != "$1" ]; then
|
||||
# Allow passing server flags directly, e.g. `docker run ... --env`.
|
||||
set -- server --env "$@"
|
||||
# Entrypoint is fixed for Docker deployments; custom args are not supported.
|
||||
if [ "$#" -ne 0 ]; then
|
||||
echo "custom entrypoint arguments are not supported; configure via SCRATCHBOX_* env vars" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
exec scratchbox "$@"
|
||||
exec scratchbox server --env
|
||||
|
||||
Reference in New Issue
Block a user