24 lines
937 B
Bash
Executable File
24 lines
937 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
script=./scripts/validate-production-env.sh
|
|
|
|
base_env='POSTGRES_DB=inventory POSTGRES_USER=inventory POSTGRES_PASSWORD=real-password DATABASE_URL=postgresql://inventory:real-password@db:5432/inventory REDIS_URL=rediss://redis:6380 SMTP_URL=smtp://mail:1025 SMTP_FROM=no-reply@example.com MFA_ENCRYPTION_KEY=stable-key PRICING_HTTP_PROVIDER_ENDPOINT=https://provider.example/prices'
|
|
|
|
if env -i PATH="$PATH" sh -c "sh $script" >/dev/null 2>&1; then
|
|
printf '%s\n' 'expected missing environment to fail' >&2
|
|
exit 1
|
|
fi
|
|
|
|
if env -i PATH="$PATH" sh -c "$base_env PRICING_FIXTURE_PROVIDER_ENABLED=true sh $script" >/dev/null 2>&1; then
|
|
printf '%s\n' 'expected fixture provider configuration to fail' >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! env -i PATH="$PATH" sh -c "$base_env sh $script" >/dev/null; then
|
|
printf '%s\n' 'expected valid environment to pass' >&2
|
|
exit 1
|
|
fi
|
|
|
|
printf '%s\n' 'production environment validation tests passed'
|