-
Notifications
You must be signed in to change notification settings - Fork 0
/
start
executable file
·45 lines (32 loc) · 1.12 KB
/
start
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
#!/usr/bin/env bash
set -eu
if [ $# -ne 1 ]; then
echo "usage: $0 watch|report"
exit 1
fi
AIVEN_CLIENT_JSON='{"project_name": "PROJECT"}'
AIVEN_CREDENTIALS_JSON='{"auth_token": "TOKEN", "user_email": "EMAIL"}'
if [[ -n "${AIVEN_TOKEN-}" ]]; then
mkdir -p ~/.config/aiven
echo ${AIVEN_CLIENT_JSON/PROJECT/$AIVEN_PROJECT} > ~/.config/aiven/aiven-client.json
AIVEN_CREDENTIALS_JSON=${AIVEN_CREDENTIALS_JSON/TOKEN/$AIVEN_TOKEN}
echo ${AIVEN_CREDENTIALS_JSON/EMAIL/$AIVEN_EMAIL}> ~/.config/aiven/aiven-credentials.json
./save-aiven-creds $AIVEN_PG_SERVICE $AIVEN_KAFKA_SERVICE
fi
ENV_DIR=.env
if [[ ! -d "$ENV_DIR" ]]; then
echo "$0: missing $ENV_DIR directory, run ./save-aiven-creds to populate it"
exit 1
fi
if [[ ! -e $ENV_DIR/KAFKA_SERVICE_URI ]]; then
echo "$0: missing $ENV_DIR/KAFKA_SERVICE_URI file"
exit 1
fi
if [[ ! -e $ENV_DIR/PG_SERVICE_URI ]]; then
echo "$0: missing $ENV_DIR/PG_SERVICE_URI file"
exit 1
fi
export PG_SERVICE_URI="$(cat $ENV_DIR/PG_SERVICE_URI)"
export KAFKA_SERVICE_URI="$(cat $ENV_DIR/KAFKA_SERVICE_URI)"
export KAFKA_CERT_DIR="$ENV_DIR"
.venv/bin/python -m sitewatch "$@"