-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
26 lines (18 loc) · 843 Bytes
/
setup.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
#!/bin/bash
# Install node modules if missing.
[[ ! -e "api/node_modules" ]] && mkdir api/node_modules/ && (cd api/node_modules/ && npm install)
[[ ! -e "web/node_modules" ]] && mkdir web/node_modules/ && (cd web/node_modules/ && npm install)
if [[ $1 ]]; then # Development mode
# Create certificate authority if missing.
if [[ ! -e "ca.crt" ]]; then
openssl genrsa -out ca.key
MSYS_NO_PATHCONV=1 openssl req -new -x509 -days 3650 -key ca.key -out ca.crt -subj "/CN=Bussiaeg.ee"
fi
# Create certificate if missing.
if [[ ! -e "tls.crt" ]]; then
openssl genrsa -out tls.key
MSYS_NO_PATHCONV=1 openssl req -new -key tls.key -out tls.csr -subj "/CN=*.devaeg.ee"
MSYS_NO_PATHCONV=1 openssl x509 -req -days 3650 -CA ca.crt -CAkey ca.key -CAcreateserial -in tls.csr -out tls.crt -extfile tls.cfg
rm tls.csr
fi
fi