Makes required arguments overrideable from environment variables (#377)

This commit is contained in:
Ben Bierens 2023-03-20 15:07:07 +01:00 committed by GitHub
parent c9a62de13f
commit b2048377e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 4 deletions

View File

@ -12,6 +12,9 @@ Stop and delete image and volume data:
# Environment variables
Codex docker image supports the following environment variables:
- LISTEN_ADDRS(*)
- API_BINDADDR(*)
- DATA_DIR(*)
- LOG_LEVEL
- METRICS_ADDR
- METRICS_PORT
@ -30,6 +33,8 @@ Codex docker image supports the following environment variables:
- ETH_ACCOUNT
- ETH_DEPLOYMENT
(*) These variables have default values in the docker image that are different from Codex's standard default values.
All environment variables are optional and will default to Codex's CLI default values.
# Constants

View File

@ -2,11 +2,27 @@ echo "Starting Codex..."
args=""
# Required arguments
args="$args --data-dir=/datadir"
args="$args --listen-addrs=/ip4/0.0.0.0/tcp/8071"
args="$args --api-bindaddr=0.0.0.0"
if [ -n "$LISTEN_ADDRS" ]; then
echo "Listen address: $LISTEN_ADDRS"
args="$args --listen-addrs=$LISTEN_ADDRS"
else
args="$args --listen-addrs=/ip4/0.0.0.0/tcp/8071"
fi
if [ -n "$API_BINDADDR" ]; then
echo "API bind address: $API_BINDADDR"
args="$args --api-bindaddr=$API_BINDADDR"
else
args="$args --api-bindaddr=0.0.0.0"
fi
if [ -n "$DATA_DIR" ]; then
echo "Data dir: $DATA_DIR"
args="$args --data-dir=$DATA_DIR"
else
args="$args --data-dir=/datadir"
fi
# Optional arguments
# Log level