#!/usr/bin/env sh
set -eu

vault_dir="/vault/secrets"

read_secret() {
  tr -d '\r\n' < "${vault_dir}/$1"
}

export MAILU_DB_NAME="$(read_secret mailu-db-secret__database)"
export MAILU_DB_USER="$(read_secret mailu-db-secret__username)"
export MAILU_DB_PASSWORD="$(read_secret mailu-db-secret__password)"
export KEYCLOAK_CLIENT_ID="$(read_secret mailu-sync-credentials__client-id)"
export KEYCLOAK_CLIENT_SECRET="$(read_secret mailu-sync-credentials__client-secret)"
export MAILU_SYSTEM_PASSWORD="$(read_secret mailu-initial-account-secret__password)"
