-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker: Allow passing secrects using files (#810)
* feat (DOCKER) BW-0: add docker secret env parsing * fix (DOCKER) #810: adjust image version for docker-compose.yml example * chore (DOCKER) #810: remove AWS_URL env var in favor of s3-endpoint flag
- Loading branch information
1 parent
0ded7b6
commit 6ca6ef6
Showing
6 changed files
with
87 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ node_modules/ | |
.DS_Store | ||
./tusd | ||
tusd_*_* | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
. /usr/local/share/load-env.sh | ||
|
||
exec tusd "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
tusd_env_vars=( | ||
AWS_ACCESS_KEY_ID | ||
AWS_SECRET_ACCESS_KEY | ||
AWS_REGION | ||
GCS_SERVICE_ACCOUNT_FILE | ||
AZURE_STORAGE_ACCOUNT | ||
AZURE_STORAGE_KEY | ||
) | ||
|
||
for env_var in "${tusd_env_vars[@]}"; do | ||
file_env_var="${env_var}_FILE" | ||
|
||
if [[ -n "${!file_env_var:-}" ]]; then | ||
if [[ -r "${!file_env_var:-}" ]]; then | ||
export "${env_var}=$(< "${!file_env_var}")" | ||
unset "${file_env_var}" | ||
else | ||
warn "Skipping export of '${env_var}'. '${!file_env_var:-}' is not readable." | ||
fi | ||
fi | ||
done | ||
|
||
unset tusd_env_vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
version: "3.9" | ||
services: | ||
tusd: | ||
image: tusproject/tusd:v1.9 | ||
command: -verbose -s3-bucket mybucket -s3-endpoint http://minio:9000 | ||
volumes: | ||
- tusd:/data | ||
environment: | ||
- AWS_REGION=us-east-1 | ||
- AWS_ACCESS_KEY_ID_FILE=/run/secrets/minio-username | ||
- AWS_SECRET_ACCESS_KEY_FILE=/run/secrets/minio-password | ||
secrets: | ||
- minio-username | ||
- minio-password | ||
networks: | ||
- tusd | ||
|
||
volumes: | ||
tusd: | ||
|
||
secrets: | ||
minio-username: | ||
external: true | ||
minio-password: | ||
external: true | ||
|
||
networks: | ||
tusd: |