|
|
@@ -0,0 +1,29 @@
|
|
|
+#!/bin/sh
|
|
|
+set -eu
|
|
|
+
|
|
|
+script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
|
+project_dir=$(CDPATH= cd -- "$script_dir/.." && pwd)
|
|
|
+compose_dir="$project_dir/docker"
|
|
|
+compose_file="${COMPOSE_FILE:-docker-compose.yml}"
|
|
|
+accounts_file="$script_dir/aitori-stylist-accounts.tsv"
|
|
|
+
|
|
|
+if [ ! -r "$accounts_file" ]; then
|
|
|
+ echo "凭据文件不存在或不可读: $accounts_file" >&2
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+cd "$compose_dir"
|
|
|
+
|
|
|
+tail -n +2 "$accounts_file" | while IFS="$(printf '\t')" read -r id username email password; do
|
|
|
+ [ -n "$id" ] || continue
|
|
|
+
|
|
|
+ echo "Creating account: $email"
|
|
|
+ docker compose -f "$compose_file" exec -T \
|
|
|
+ -e INITIAL_STYLIST_ID="$id" \
|
|
|
+ -e INITIAL_STYLIST_USERNAME="$username" \
|
|
|
+ -e INITIAL_STYLIST_EMAIL="$email" \
|
|
|
+ -e INITIAL_STYLIST_PASSWORD="$password" \
|
|
|
+ backend node /app/prisma/seed-initial.cjs < /dev/null
|
|
|
+done
|
|
|
+
|
|
|
+echo 'Account import finished.'
|