diff --git a/README.md b/README.md index a7b8a77..08fcdad 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,8 @@ Default login is `wallabag:wallabag`. - `-e POPULATE_DATABASE=...`(defaults to "True". Does the DB has to be populated or is it an existing one) - `-e SYMFONY__ENV__SERVER_NAME=...` (defaults to "Your wallabag instance". Specifies a user-friendly name for the 2FA issuer) +To set any of these environment variables from a file (for instance a Docker Secret), append `__FILE` to the name of the environment variable. + ## SQLite The easiest way to start wallabag is to use the SQLite backend. You can spin that up with diff --git a/root/entrypoint.sh b/root/entrypoint.sh index ccac86e..4815fda 100755 --- a/root/entrypoint.sh +++ b/root/entrypoint.sh @@ -1,5 +1,14 @@ #!/bin/sh +FILE_ENV_VARS="$(env | grep '__FILE=')" +for env_var in $FILE_ENV_VARS; do + var_name="$(echo $env_var | grep -o '.*__FILE=' | sed 's/__FILE=//g')" + file_path="$(echo $env_var | grep -o '__FILE=.*' | sed 's/__FILE=//g')" + file_content="$(cat $file_path)" + new_var="$(echo $var_name=$file_content)" + export $(echo $new_var | xargs) +done + provisioner () { echo "Starting provisioner..." if ! out=`ansible-playbook -i /etc/ansible/hosts /etc/ansible/entrypoint.yml -c local "$@"`;then