- Renamed auth-service to iam-service across various files for consistency. - Updated deployment workflows, database migration scripts, and documentation to reflect the service name change. - Enhanced bilingual documentation for clarity on the new service structure and usage. - Removed outdated references to auth-service in scripts and configuration files to streamline the project structure.
42 lines
953 B
Bash
Executable File
42 lines
953 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
SERVICE=$1
|
|
|
|
# EN: Validate argument
|
|
# VI: Xác thực tham số
|
|
if [ -z "$SERVICE" ]; then
|
|
echo "Usage: $0 <service-name>"
|
|
echo "Example: $0 iam-service"
|
|
exit 1
|
|
fi
|
|
|
|
# EN: Check if service exists
|
|
# VI: Kiểm tra xem service có tồn tại không
|
|
if [ ! -d "services/$SERVICE" ]; then
|
|
echo "❌ Service $SERVICE not found"
|
|
exit 1
|
|
fi
|
|
|
|
echo "🌱 Seeding database for $SERVICE..."
|
|
|
|
cd "services/$SERVICE"
|
|
|
|
# EN: Check if DATABASE_URL is set
|
|
# VI: Kiểm tra DATABASE_URL đã được thiết lập chưa
|
|
if [ -z "$DATABASE_URL" ]; then
|
|
if [ -f ".env" ]; then
|
|
export $(grep -v '^#' .env | xargs)
|
|
elif [ -f "../../deployments/local/.env.local" ]; then
|
|
export $(grep -v '^#' ../../deployments/local/.env.local | xargs)
|
|
else
|
|
echo "⚠️ DATABASE_URL not set. Please set it in .env or environment variable."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
pnpm prisma:seed
|
|
|
|
echo "✅ Database seeded!"
|