You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

58 lines
1.7 KiB

#!/bin/bash
set -eu
mkdir -p /run/bitwardenrs
if [[ ! -f /app/data/config.env ]]; then
cat <<EOT > /app/data/config.env
# Export bitwarden rs environment variables here to ovveride the defaults
#export SIGNUPS_ALLOWED=false
#export INVITATIONS_ALLOWED=true
# To only allow users with the same email domain as where the app is installed:
#export SIGNUPS_DOMAINS_WHITELIST=${CLOUDRON_MAIL_DOMAIN}
export LOG_LEVEL=info
EOT
fi
source /app/data/config.env
echo "=> Exporting env vars expected by Bitwarden"
export SIGNUPS_ALLOWED=${SIGNUPS_ALLOWED:-true}
export DOMAIN=$CLOUDRON_APP_ORIGIN
export SMTP_HOST=$CLOUDRON_MAIL_SMTP_SERVER
export SMTP_FROM=$CLOUDRON_MAIL_FROM
export SMTP_FROM_NAME=${CLOUDRON_MAIL_FROM}
export SMTP_PORT=$CLOUDRON_MAIL_SMTP_PORT
export SMTP_SSL=false
export SMTP_EXPLICIT_TLS=false
export SMTP_USERNAME=$CLOUDRON_MAIL_SMTP_USERNAME
export SMTP_PASSWORD=$CLOUDRON_MAIL_SMTP_PASSWORD
export SMTP_AUTH_MECHANISM="Plain"
export SMTP_TIMEOUT=15
export DATABASE_URL=$CLOUDRON_MYSQL_URL
export ENABLE_DB_WAL=false
export ROCKET_ENV "staging"
export ROCKET_PORT=3000
export ROCKET_WORKERS=10
export DATA_FOLDER=/app/data
export CONFIG_FILE=/app/data/config.json
export RUST_BACKTRACE=1
export WEBSOCKET_ENABLED=true
export LOG_FILE=/run/bitwardenrs/bitwardenrs.log
# Generate admin token if it doesn't exist
if [[ ! -f /app/data/admin_token ]]; then
pwgen -1 48 -s > /app/data/admin_token
fi
export ADMIN_TOKEN=$(cat /app/data/admin_token)
echo "=> Admin token: ${ADMIN_TOKEN}"
chown -R cloudron:cloudron /run/bitwardenrs /app/data
echo "=> Starting supervisord"
rm -f /run/apache2/apache2.pid
exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i Bitwarden