forked from Rbillon59/hass-n8n
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
executable file
·51 lines (37 loc) · 1.28 KB
/
docker-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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
CONFIG_PATH="/data/options.json"
N8N_PATH="/data/n8n"
mkdir -p "${N8N_PATH}/.n8n"
#####################
## USER PARAMETERS ##
#####################
# REQUIRED
export N8N_BASIC_AUTH_ACTIVE="$(jq --raw-output '.auth // empty' $CONFIG_PATH)"
export N8N_BASIC_AUTH_USER="$(jq --raw-output '.auth_username // empty' $CONFIG_PATH)"
export N8N_BASIC_AUTH_PASSWORD="$(jq --raw-output '.auth_password // empty' $CONFIG_PATH)"
export GENERIC_TIMEZONE="$(jq --raw-output '.timezone // empty' $CONFIG_PATH)"
export N8N_PROTOCOL="$(jq --raw-output '.protocol // empty' $CONFIG_PATH)"
export N8N_SSL_CERT="/ssl/$(jq --raw-output '.certfile // empty' $CONFIG_PATH)"
export N8N_SSL_KEY="/ssl/$(jq --raw-output '.keyfile // empty' $CONFIG_PATH)"
export N8N_USER_FOLDER="${N8N_PATH}"
if [ -z "${N8N_BASIC_AUTH_USER}" ] || [ -z "${N8N_BASIC_AUTH_ACTIVE}" ]; then
export N8N_BASIC_AUTH_ACTIVE=false
unset N8N_BASIC_AUTH_USER
unset N8N_BASIC_AUTH_PASSWORD
fi
###########
## MAIN ##
###########
if [ -d ${N8N_PATH} ] ; then
chmod o+rx ${N8N_PATH}
chown -R node ${N8N_PATH}/.n8n
ln -s ${N8N_PATH}/.n8n /home/node/
fi
chown -R node /home/node
if [ "$#" -gt 0 ]; then
# Got started with arguments
exec su-exec node "$@"
else
# Got started without arguments
exec su-exec node n8n
fi