-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·32 lines (27 loc) · 1023 Bytes
/
entrypoint.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
32
#!/bin/bash
set -e
# Function to URL-encode a string
urlencode() {
local string="$1"
local encoded=""
local length="${#string}"
for ((i = 0; i < length; i++)); do
local char="${string:i:1}"
case "$char" in
[a-zA-Z0-9.~_-]) encoded+="$char" ;;
*) encoded+="%"$(printf "%02X" "'$char") ;;
esac
done
echo "$encoded"
}
# This supports both the old environment variables and new ones specific to the Figma setup.
if [ -n "$PG_FIGMA_FOR_JIRA_DB_ROLE" ]; then
DATABASE_URL="postgresql://${PG_FIGMA_FOR_JIRA_DB_ROLE}:${PG_FIGMA_FOR_JIRA_DB_PASSWORD}@${PG_FIGMA_FOR_JIRA_DB_HOST}:${PG_FIGMA_FOR_JIRA_DB_PORT}/${PG_FIGMA_FOR_JIRA_DB_SCHEMA}?sslmode=${PG_FIGMA_FOR_JIRA_DB_SSL_MODE}"
else
ENCODED_PASSWORD="$(urlencode "$PG_INTEGRATIONS_JIRA_PASSWORD")"
DATABASE_URL="postgresql://${PG_INTEGRATIONS_JIRA_USER}:${ENCODED_PASSWORD}@${PG_INTEGRATIONS_HOST}:${PG_INTEGRATIONS_PORT}/${PG_INTEGRATIONS_DATABASE}"
fi
export DATABASE_URL
npx prisma migrate deploy
npx prisma generate
node server.js