-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathdocker-entrypoint.sh
executable file
·38 lines (30 loc) · 1 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
#!/bin/bash
if [[ -n "${TZ}" ]]; then
echo "Timezone set to ${TZ}"
fi
./chia.bin init --fix-ssl-permissions
if [[ -n ${CHIA_HOSTNAME} ]]; then
yq -i '.self_hostname = env(CHIA_HOSTNAME)' "$CHIA_ROOT/config/config.yaml"
else
yq -i '.self_hostname = "127.0.0.1"' "$CHIA_ROOT/config/config.yaml"
fi
if [[ -n "${CHIA_UPNP}" ]]; then
./chia.bin configure --upnp "${CHIA_UPNP}"
fi
if [[ -n "${CHIA_LOG_LEVEL}" ]]; then
./chia.bin configure --log-level "${CHIA_LOG_LEVEL}"
fi
for p in ${CHIA_PLOTS//:/ }; do
mkdir -p "${p}"
if [[ ! $(ls -A "$p") ]]; then
echo "Plots directory '${p}' appears to be empty, try mounting a plot directory with the docker -v command"
fi
./chia.bin plots add -d "${p}"
done
## Remote Harvester Support
if [[ ${CHIA_SERVICES} == "harvester" ]]; then
if [[ -n ${CHIA_FARMER_ADDRESS} && -n ${CHIA_FARMER_PORT} && -n ${CHIA_CA} ]]; then
./chia.bin init -c "${CHIA_CA}" && ./chia.bin configure --set-farmer-peer "${CHIA_FARMER_ADDRESS}:${CHIA_FARMER_PORT}"
fi
fi
exec "$@"