-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathscript.sh
31 lines (29 loc) · 1.27 KB
/
script.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
#!/bin/bash
echo "STRIPE_SECRET_KEY = $STRIPE_SECRET_KEY"
echo "STRIPE_CANCEL_URL = $STRIPE_CANCEL_URL"
echo "STRIPE_SUCCESS_URL = $STRIPE_SUCCESS_URL"
echo "STRIPE_WHSEC = $STRIPE_WHSEC"
echo "HOST = $HOST"
echo "PORT = $PORT"
echo "DEVELOPMENT = $DEVELOPMENT"
# Serve Offline
if [[ -n "$DEVELOPMENT" ]]; then
echo "Serving Offline..."
# stripe listen --print-secret --api-key "$STRIPE_SECRET_KEY" > secret.txt &
# wait $!
# nohup stripe listen --forward-to "http://0.0.0.0:8090/stripe" --api-key "$STRIPE_SECRET_KEY" --live > stripe.out 2>&1 &
nohup ./bin/app-amd64-linux serve --http "0.0.0.0:8090"
# Serve Online
elif [[ -n "$HOST" && -n "$STRIPE_SECRET_KEY" ]]; then
echo "Serving Online..."
# nohup stripe listen --print-secret --api-key "$STRIPE_SECRET_KEY" > secret.txt &
# wait $!
# echo "WHSEC = $(<secret.txt)"
# nohup stripe listen --forward-to "https://$HOST/stripe" --api-key "$STRIPE_SECRET_KEY" --live > stripe.out 2>&1 &
nohup ./bin/app-amd64-linux serve --http "0.0.0.0:8090"
# Error
else
# Handle the case where the environment variables are not set
echo "Environment variables HOST, STRIPE_SECRET_KEY, and PORT must be set or else you should use the local environment variable LOCAL to serve http on port 8090"
exit 1
fi