#!/bin/bash # Entrypoint for Docker Container set -e default_filter="(|(username={{username}})(mail={{username}}))" PORT_TRUSTED=${PORT_TRUSTED:-'3000'} PORT_SANDBOX=${PORT_SANDBOX:-'3003'} PORT_PUBLIC=${PORT_PUBLIC:-'3004'} URL_BASE_TRUSTED=${URL_BASE_TRUSTED:-"http://localhost:${PORT_TRUSTED}"} URL_BASE_SANDBOX=${URL_BASE_SANDBOX:-"http://localhost:${PORT_SANDBOX}"} URL_BASE_PUBLIC=${URL_BASE_PUBLIC:-"http://localhost:${PORT_PUBLIC}"} WWW_HOST=${WWW_HOST:-'0.0.0.0'} WWW_PROXY=${WWW_PROXY:-'false'} WWW_SECRET=${WWW_SECRET:-$(pwgen -1)} WITH_LDAP=${WITH_LDAP:-'false'} LDAP_HOST=${LDAP_HOST:-'ldap'} LDAP_PORT=${LDAP_PORT:-'389'} LDAP_SECURE=${LDAP_SECURE:-'false'} LDAP_BIND_USER=${LDAP_BIND_USER:-'name@company.net'} LDAP_BIND_PASS=${LDAP_BIND_PASS:-'mySecretPassword'} LDAP_FILTER=${LDAP_FILTER:-${default_filter}} LDAP_BASEDN=${LDAP_BASEDN:-ou=users,dc=company} LDAP_UIDTAG=${LDAP_UIDTAG:-'username'} LDAP_MAILTAG=${LDAP_MAILTAG:-'mail'} LDAP_NAMETAG=${LDAP_NAMETAG:-'username'} LDAP_METHOD=${LDAP_METHOD:-'ldapjs'} MONGO_HOST=${MONGO_HOST:-'mongo'} WITH_REDIS=${WITH_REDIS:-'true'} REDIS_HOST=${REDIS_HOST:-'redis'} MYSQL_HOST=${MYSQL_HOST:-'mysql'} MYSQL_DATABASE=${MYSQL_DATABASE:-'mailtrain'} MYSQL_USER=${MYSQL_USER:-'mailtrain'} MYSQL_PASSWORD=${MYSQL_PASSWORD:-'mailtrain'} WITH_ZONE_MTA=${WITH_ZONE_MTA:-'true'} POOL_NAME=${POOL_NAME:-$(hostname)} LOG_LEVEL=${LOG_LEVEL:-'info'} # Warning for users that already rely on the MAILTRAIN_SETTING variable # Can probably be removed in the future. MAILTRAIN_SETTING=${MAILTRAIN_SETTINGS:-} if [ ! -z "$MAILTRAIN_SETTING" ]; then echo 'Error: MAILTRAIN_SETTINGS is no longer supported. See README.md' exit 1 fi if [ -f server/config/production.yaml ]; then echo 'Info: application/production.yaml already provisioned' else echo 'Info: Generating application/production.yaml' # Basic configuration cat >> server/config/production.yaml <> server/config/production.yaml <> server/config/production.yaml < server/services/workers/reports/config/production.yaml <