forked from unee-t/frontend
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenv-setup.bash
executable file
·52 lines (47 loc) · 1.46 KB
/
env-setup.bash
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
51
52
#!/bin/bash
if test -f .env
then
echo .env already exists. Stopping.
exit
fi
ssm() {
echo $(aws --profile uneet-dev ssm get-parameters --names $1 --with-decryption --query Parameters[0].Value --output text)
}
setuplocal() {
cat << EOF >> .env
APIENROLL_LAMBDA_URL=http://localhost:4000
INVITE_LAMBDA_URL=http://localhost:9000
UNIT_CREATE_LAMBDA_URL=http://localhost:4001/create
EOF
}
cat << EOF > .env
BUGZILLA_ADMIN_KEY=$(ssm BUGZILLA_ADMIN_KEY)
MAIL_URL=smtps://$(ssm SES_SMTP_USERNAME):$(ssm SES_SMTP_PASSWORD)@email-smtp.us-west-2.amazonaws.com:465
CLOUDINARY_API_ENDPOINT=https://api.cloudinary.com/v1_1/unee-t-staging/image/upload
CLOUDINARY_PRESET=$(ssm CLOUDINARY_PRESET)
API_ACCESS_TOKEN=$(ssm API_ACCESS_TOKEN)
FROM_EMAIL="Local Unee-T Case <[email protected]>"
STAGE=$(ssm STAGE)
DOMAIN=$(ssm DOMAIN)
PDFGEN_LAMBDA_URL=https://pdfgen.dev.unee-t.com
PDFCONVERT_LAMBDA_URL=https://prince.dev.unee-t.com
EOF
if ! curl -s localhost:8081
then
read -p "https://github.com/unee-t/bugzilla-customisation not running, use https://dashboard.dev.unee-t.com/ ?" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
cat << EOF >> .env
APIENROLL_LAMBDA_URL=https://apienroll.dev.unee-t.com
INVITE_LAMBDA_URL=https://invite.dev.unee-t.com
UNIT_CREATE_LAMBDA_URL=https://unit.dev.unee-t.com/create
BUGZILLA_URL=https://dashboard.dev.unee-t.com/
EOF
else
echo Setting up for local https://github.com/unee-t/bugzilla-customisation
setuplocal
fi
else
setuplocal
fi