feat: add .env file existence check and load it in startup script
This commit is contained in:
parent
b4c0f17b12
commit
f23e1c41ff
1 changed files with 19 additions and 0 deletions
|
|
@ -100,6 +100,25 @@ if [[ ! -d "$INFCTL_INSTALL_DIR" ]]; then
|
||||||
chown -R user:user "$INFCTL_INSTALL_DIR"
|
chown -R user:user "$INFCTL_INSTALL_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
for i in {1..100}; do
|
||||||
|
if [[ -f /opt/src/infctl-cli/.env ]]; then
|
||||||
|
echo ".env file found."
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo ".env file not found. Attempt $i/100. Waiting 5 seconds..."
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Final check after loop
|
||||||
|
if [[ ! -f /opt/src/infctl-cli/.env ]]; then
|
||||||
|
echo "ERROR: .env file not found after 10 attempts. Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# load .env file
|
||||||
|
source /opt/src/infctl-cli/.env
|
||||||
|
|
||||||
# check to see if INSTALL_FORGEJO is set to "true"
|
# check to see if INSTALL_FORGEJO is set to "true"
|
||||||
if [[ "$INSTALL_FORGEJO" == "true" ]]; then
|
if [[ "$INSTALL_FORGEJO" == "true" ]]; then
|
||||||
# install forgejo using infctl
|
# install forgejo using infctl
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue