-
Notifications
You must be signed in to change notification settings - Fork 209
/
Copy pathenv.sh
46 lines (39 loc) · 1.14 KB
/
env.sh
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
if [ -z "$S3_BUCKET" ]; then
echo "You need to set the S3_BUCKET environment variable."
exit 1
fi
if [ "$BACKUP_ALL" != "true" ] && [ -z "$POSTGRES_DATABASE" ]; then
echo "You need to set the POSTGRES_DATABASE environment variable."
exit 1
fi
if [ -z "$POSTGRES_HOST" ]; then
# https://docs.docker.com/network/links/#environment-variables
if [ -n "$POSTGRES_PORT_5432_TCP_ADDR" ]; then
POSTGRES_HOST=$POSTGRES_PORT_5432_TCP_ADDR
POSTGRES_PORT=$POSTGRES_PORT_5432_TCP_PORT
else
echo "You need to set the POSTGRES_HOST environment variable."
exit 1
fi
fi
if [ -z "$POSTGRES_USER" ]; then
echo "You need to set the POSTGRES_USER environment variable."
exit 1
fi
if [ -z "$POSTGRES_PASSWORD" ]; then
echo "You need to set the POSTGRES_PASSWORD environment variable."
exit 1
fi
if [ -z "$S3_ENDPOINT" ]; then
aws_args=""
else
aws_args="--endpoint-url $S3_ENDPOINT"
fi
if [ -n "$S3_ACCESS_KEY_ID" ]; then
export AWS_ACCESS_KEY_ID=$S3_ACCESS_KEY_ID
fi
if [ -n "$S3_SECRET_ACCESS_KEY" ]; then
export AWS_SECRET_ACCESS_KEY=$S3_SECRET_ACCESS_KEY
fi
export AWS_DEFAULT_REGION=$S3_REGION
export PGPASSWORD=$POSTGRES_PASSWORD