-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenenv.sh
More file actions
executable file
·50 lines (38 loc) · 1.32 KB
/
genenv.sh
File metadata and controls
executable file
·50 lines (38 loc) · 1.32 KB
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
47
48
49
50
#!/bin/bash
ENV_FILE=".env"
if [ -f "$ENV_FILE" ]; then
echo "Exiting: $ENV_FILE already exists:"
cat $ENV_FILE
exit 1
else
echo "Generating $ENV_FILE with secrets..."
fi
generate_rand4() {
openssl rand -base64 32 | tr -dc 'a-z0-9' | head -c 4
}
generate_secret() {
openssl rand -base64 32 | tr -d '/+' | cut -c1-32
}
echo "COMPOSE_PROJECT_NAME=dingolytics-$(generate_rand4)" >> ${ENV_FILE}
echo "Application server tag: 0.1.3"
echo "APPLICATION_SERVER_TAG=0.1.3" >> ${ENV_FILE}
echo "Application front-end tag: 0.1.0"
echo "APPLICATION_FRONTEND_TAG=0.1.0" >> ${ENV_FILE}
WEB_HOST=:8100
echo "Local web host (customize it): ${WEB_HOST}"
echo "WEB_HOST=${WEB_HOST}" >> ${ENV_FILE}
WEB_HOST_LETSENCRYPT_EMAIL=internal
echo "Email for Let's Encrypt (customize it): ${WEB_HOST_LETSENCRYPT_EMAIL}"
echo "WEB_HOST_LETSENCRYPT_EMAIL=${WEB_HOST_LETSENCRYPT_EMAIL}" >> ${ENV_FILE}
VECTOR_INGEST_URL="[HOST]"
echo "Vector ingest host (customize it): ${VECTOR_INGEST_URL}"
echo "VECTOR_INGEST_URL=[HOST]" >> ${ENV_FILE}
echo "Adding secrets to ${ENV_FILE}..."
{
echo "# Secrets:"
echo "POSTGRES_PASSWORD=$(generate_secret)"
echo "CLICKHOUSE_PASSWORD=$(generate_secret)"
echo "SECRET_KEY=$(generate_secret)"
echo "DATASOURCE_SECRET_KEY=$(generate_secret)"
} >> "$ENV_FILE"
echo "Done: ${ENV_FILE} saved."