Added deployment files
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
umask 077
|
||||
|
||||
env_file=${1:-/opt/merchantflow/production.env}
|
||||
if [[ -e "$env_file" ]]; then
|
||||
echo "Refusing to overwrite existing configuration: $env_file" >&2
|
||||
exit 1
|
||||
fi
|
||||
command -v openssl >/dev/null
|
||||
password=$(openssl rand -hex 32)
|
||||
mkdir -p "$(dirname "$env_file")"
|
||||
# noclobber also protects against a concurrent initialization.
|
||||
set -o noclobber
|
||||
cat > "$env_file" <<EOF
|
||||
POSTGRES_PASSWORD=$password
|
||||
DATABASE_URL=postgresql://merchantflow:$password@db:5432/merchantflow
|
||||
APP_ORIGIN=https://merchantflow.prvt.you
|
||||
NODE_ENV=production
|
||||
API_HOST=0.0.0.0
|
||||
API_PORT=3001
|
||||
EOF
|
||||
unset password
|
||||
echo "Created $env_file with private permissions. Keep it outside Git."
|
||||
Reference in New Issue
Block a user