forked from jonasrosland/gitmirror
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
29 lines (26 loc) · 865 Bytes
/
Copy pathstart.sh
File metadata and controls
29 lines (26 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
set -e
# Generate a random SECRET_KEY if not provided
if [ -z "$SECRET_KEY" ]; then
echo "No SECRET_KEY found in environment, generating a random one..."
export SECRET_KEY=$(python -c "import secrets; print(secrets.token_hex(32))")
echo "Generated SECRET_KEY: $SECRET_KEY"
fi
# Check if .env file exists, if not, create it from example
if [ ! -f .env ]; then
echo "No .env file found, creating from .env.example..."
cp .env.example .env
echo "Please update the .env file with your credentials."
fi
# Check the first argument to determine what to run
if [ "$1" = "web" ]; then
echo "Starting web UI..."
exec python -m gitmirror.web
elif [ "$1" = "mirror" ]; then
echo "Running mirror script..."
exec python -m gitmirror.mirror
else
echo "Unknown command: $1"
echo "Usage: $0 [web|mirror]"
exit 1
fi