Support loading env vars from .env files in container
This commit is contained in:
parent
0c3860cf9b
commit
57350924a5
2 changed files with 20 additions and 0 deletions
|
|
@ -39,6 +39,10 @@ services:
|
|||
|
||||
Certain values can be set via environment variables, using the `-e` parameter on the docker command line, or the `environment:` section in docker-compose.
|
||||
|
||||
You can also load variables from files:
|
||||
* Docker CLI supports `--env-file /path/to/.env`.
|
||||
* The container entrypoint auto-loads `/app/.env` if present, and also loads a custom file when `ENV_FILE` points to it.
|
||||
|
||||
### ⬇️ Download Behavior
|
||||
|
||||
* __MAX_CONCURRENT_DOWNLOADS__: Maximum number of simultaneous downloads allowed. For example, if set to `5`, then at most five downloads will run concurrently, and any additional downloads will wait until one of the active downloads completes. Defaults to `3`.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
load_env_file() {
|
||||
env_file="$1"
|
||||
if [ -f "$env_file" ]; then
|
||||
echo "Loading environment from ${env_file}"
|
||||
# shellcheck disable=SC1090
|
||||
set -a
|
||||
. "$env_file"
|
||||
set +a
|
||||
fi
|
||||
}
|
||||
|
||||
load_env_file "/app/.env"
|
||||
if [ -n "${ENV_FILE}" ]; then
|
||||
load_env_file "${ENV_FILE}"
|
||||
fi
|
||||
|
||||
PUID="${UID:-$PUID}"
|
||||
PGID="${GID:-$PGID}"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue